*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: rgba(0, 0, 0);
    --bg2: rgb(0, 0, 0);
    --surface-rgb: rgba(3, 3, 3, 0.2);
    --surface: rgba(3, 3, 3);
    --surface2: rgb(5, 5, 5);
    --surface3: rgb(7, 7, 7);
    --fg: #f5f5f5;
    --fg-muted: #cfcfcf;
    --muted: #9a9aa8;
    --light: #7a7a7a;
    --border: rgb(15, 15, 15);
    --border-light: rgba(20, 20, 20);
    --accent: #ffffff;
    --accent-hover: #ececec;
    --danger: #e11d48;
    --danger-hover: #be123c;
    --success: #10a37f;
    --warning: #f59e0b;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --sidebar-w: 260px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --transition: all 0.15s ease;
}

[data-theme="light"] {
    --bg: #ffffff;
    --bg2: rgba(240, 240, 240);
    --surface-rgb: rgba(249, 249, 249, 0.8);
    --surface: #f9f9f9;
    --surface2: #efefef;
    --surface3: #e5e5e5;
    --fg: #0d0d0d;
    --fg-muted: #444444;
    --muted: #6b6b6b;
    --light: #a0a0a0;
    --border: #e5e5e5;
    --border-light: #f0f0f0;
    --accent: #0d0d0d;
    --accent-hover: #1a1a1a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.theme-switching {
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

* {
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*:not(.theme-switching) {
    transition: none !important;
}

.theme-switching * {
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

html {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background: var(--bg);
    overflow-x: hidden;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button {
    font-family: var(--font);
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    transition: var(--transition);
}

input,
textarea,
select {
    font-family: var(--font);
    color: var(--fg);
    background: transparent;
}

.hidden {
    display: none !important;
}

.layout {
    display: flex;
    height: 100dvh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 10;
}

.sidebar.collapsed {
    width: 0;
}

.sidebar-inner {
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-top {
    padding: 10px 12px 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 10px;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg-muted);
    flex-shrink: 0;
    cursor: pointer;
}

.icon-btn:hover {
    background: var(--surface2);
    color: var(--fg);
}

.new-chat-btn,
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--fg);
    width: 100%;
    text-align: left;
    background: transparent;
}

.new-chat-btn:hover,
.sidebar-nav-item:hover {
    background: var(--surface2);
}

.sidebar-nav-item.active {
    background: var(--surface2);
    font-weight: 500;
}

.new-chat-btn svg,
.sidebar-nav-item svg,
.new-chat-btn i,
.sidebar-nav-item i {
    flex-shrink: 0;
    width: 18px;
    color: var(--fg);
    font-size: 16px;
    text-align: center;
}

.sidebar-history {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--surface3) transparent;
}

.sidebar-history::-webkit-scrollbar {
    width: 4px;
}

.sidebar-history::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-history::-webkit-scrollbar-thumb {
    background: var(--surface3);
    border-radius: 10px;
}

.history-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    padding: 12px 10px 6px;
    letter-spacing: 0.02em;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    gap: 8px;
    margin-bottom: 1px;
}

.history-item:hover {
    background: var(--surface2);
}

.history-item.active {
    background: var(--surface2);
}

.history-item-text {
    font-size: 0.875rem;
    color: var(--fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    font-weight: 400;
}

.history-item-del {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
}

.history-item-del:hover {
    background: var(--surface3);
    color: var(--danger);
}

.sidebar-bottom {
    padding: 8px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.user-info:hover {
    background: var(--surface2);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #19c37d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
    overflow: hidden;
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-plan {
    font-size: 0.75rem;
    color: var(--muted);
}

.auth-prompt {
    padding: 4px 6px 8px;
}

.auth-prompt-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fg);
    margin-bottom: 3px;
}

.auth-prompt-sub {
    font-size: 0.8125rem;
    color: var(--muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

.auth-login-btn {
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius);
    background: var(--surface2);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--fg);
    cursor: pointer;
}

.auth-login-btn:hover {
    background: var(--surface3);
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg);
    min-width: 0;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    flex-shrink: 0;
    gap: 8px;
    background: var(--bg);
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--fg);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius);
}

.topbar-title:hover {
    background: var(--surface);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-login-btn {
    padding: 7px 16px;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--bg);
    font-size: 0.8125rem;
    font-weight: 500;
}

.topbar-login-btn:hover {
    opacity: 0.85;
}

.topbar-new-chat-btn {
    display: none;
}

@media (max-width: 680px) {
    .topbar-new-chat-btn {
        display: flex;
    }
}

.scroll-to-bottom-btn {
    display: none;
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--surface-rgb);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    color: var(--fg);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s ease;
    font-size: 0.5rem;
}

.scroll-to-bottom-btn:hover {
    background: var(--surface2);
}

.scroll-to-bottom-btn:active {
    transform: scale(0.95);
}

.scroll-to-bottom-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-to-bottom-btn.swiping-down {
    transform: translateY(20px);
    opacity: 0.5;
}

@media (max-width: 680px) {
    .scroll-to-bottom-btn {
        display: flex;
        opacity: 0;
        transform: translateY(10px);
        transition: all 0.3s ease;
    }

    .scroll-to-bottom-btn.visible {
        opacity: 1;
        transform: translateY(0);
    }
}

.page {
    flex: 1;
    overflow: hidden;
    display: none;
    flex-direction: column;
    min-height: 0;
}

.page.active {
    display: flex;
}

.chat-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    position: relative;
}

.feed {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    padding: 32px 0 160px;
    min-height: 0;
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
    mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
}

.feed::-webkit-scrollbar {
    width: 5px;
}

.feed::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.feed-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 4px;
}

.feed-empty-title {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--fg);
    text-align: center;
    max-width: 80%;
}

.feed:has(.feed-empty)~.input-area {
    position: absolute;
    top: 50%;
    bottom: auto;
    padding: 0;
    width: 350px;
    margin-top: 10px;
}

.feed:has(.feed-empty)~.input-area .input-box {
    max-width: 600px;
}

.chat-wrap.empty-chat .input-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 40px));
    bottom: auto;
    padding: 0;
    width: 350px;
}

.chat-wrap.empty-chat .input-area .input-box {
    max-width: 600px;
}

.msg-row {
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    padding: 2px 24px;
}

.msg-row.user {
    display: flex;
    justify-content: flex-end;
}

.msg-row.bot {
    display: flex;
    justify-content: flex-start;
}

.user-bub {
    background: var(--surface);
    color: var(--fg);
    padding: 10px 18px;
    border-radius: 18px 18px 4px 18px;
    font-size: 0.9375rem;
    line-height: 1.55;
    max-width: 80%;
    word-break: break-word;
}

.bot-bub {
    color: var(--fg);
    font-size: 0.9375rem;
    line-height: 1.75;
    max-width: 100%;
    word-break: break-word;
    padding: 4px 0;
}

.bot-bub p {
    margin-bottom: 12px;
}

.bot-bub p:last-child {
    margin-bottom: 0;
}

.bot-bub code {
    font-family: "SF Mono", ui-monospace, monospace;
    font-size: 0.8125rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
}

.bot-bub pre {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px 20px;
    overflow-x: auto;
    margin: 14px 0;
    font-size: 0.8125rem;
    font-family: "SF Mono", ui-monospace, monospace;
    line-height: 1.6;
}

.bot-bub pre code {
    background: none;
    padding: 0;
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 5%, black 95%, transparent);
    mask-image: linear-gradient(to bottom, transparent, black 5%, black 95%, transparent);
}

.bot-bub h1,
.bot-bub h2,
.bot-bub h3,
.bot-bub h4,
.bot-bub h5,
.bot-bub h6 {
    margin: 1.2em 0 0.6em;
    font-weight: 700;
    line-height: 1.3;
    color: var(--fg);
}

.bot-bub h1 {
    font-size: 1.75em;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.3em;
}

.bot-bub h2 {
    font-size: 1.5em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.25em;
}

.bot-bub h3 {
    font-size: 1.25em;
}

.bot-bub ul,
.bot-bub ol {
    margin: 0.6em 0 0.6em 1.5em;
}

.bot-bub li {
    margin: 0.3em 0;
    line-height: 1.65;
}

.bot-bub blockquote {
    margin: 0.8em 0;
    padding: 0.4em 1em;
    background: var(--surface);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--muted);
    font-style: italic;
}

.bot-bub a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.bot-bub a:hover {
    opacity: 0.8;
}

.think-block {
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.think-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
}

.think-caret {
    width: 14px;
    height: 14px;
    color: var(--muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.think-block.open .think-caret {
    transform: rotate(90deg);
}

.think-lbl {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
}

.think-body {
    display: none;
    padding: 0 14px 14px;
    font-size: 0.8125rem;
    color: var(--muted);
    line-height: 1.65;
    font-style: italic;
    white-space: pre-wrap;
}

.think-block.open .think-body {
    display: block;
}

.gen-img-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gen-img-cap {
    font-size: 0.75rem;
    color: var(--muted);
}

.gen-img {
    max-width: 100%;
    border-radius: var(--radius-lg);
    display: block;
    box-shadow: var(--shadow-lg);
}

.dots {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 0;
}

.dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
    animation: db 1.2s infinite;
}

.dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes db {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            var(--surface) 25%,
            var(--surface2) 50%,
            var(--surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

.input-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 999;
    display: none;
}

.input-backdrop.visible {
    display: block;
}

.input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 24px 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 600px;
    margin: 0 auto;
}

.input-box {
    background: var(--surface-rgb);
    backdrop-filter: blur(5px) saturate(2);
    -webkit-backdrop-filter: blur(5px) saturate(2);
    border-radius: 3vh;
    padding-top: 6px;
    padding-bottom: 6px;
    padding-left: 4px;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-box:focus-within {
    border-color: var(--surface3);
}

#inp {
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9375rem;
    color: var(--fg);
    resize: none;
    width: 100%;
    min-height: 24px;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: none;
    padding: 0;
    line-height: 1.6;
}

#inp::placeholder {
    color: var(--muted);
}

.input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.input-row-inline {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 0 4px;
}

.input-row-inline #inp {
    flex: 1;
    min-height: 40px;
    padding: 10px 0;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.input-row-inline .input-tool-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg-muted);
    flex-shrink: 0;
}

.input-row-inline .input-tool-btn:hover {
    background: var(--surface2);
    color: var(--fg);
}

.input-row-inline .send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--fg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--bg);
}

.input-row-inline .send-btn:hover:not(:disabled) {
    opacity: 0.85;
    transform: scale(1.04);
}

.input-row-inline .send-btn:disabled {
    background: var(--surface3);
    cursor: not-allowed;
    opacity: 0.5;
    color: var(--muted);
}

.input-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.input-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-tool-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg-muted);
}

.input-tool-btn:hover {
    background: var(--surface2);
    color: var(--fg);
}

.model-select-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--fg-muted);
    background: transparent;
}

.model-select-btn:hover {
    background: var(--surface2);
    color: var(--fg);
}

.send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--fg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--bg);
}

.send-btn:hover:not(:disabled) {
    opacity: 0.85;
    transform: scale(1.04);
}

.send-btn:disabled {
    background: var(--surface3);
    cursor: not-allowed;
    opacity: 0.5;
    color: var(--muted);
}

.model-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.model-picker {
    background: var(--surface);
    border-radius: 5vh;
    box-shadow: var(--shadow-lg);
    width: 340px;
    overflow: hidden;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 15px;
}

.model-picker-head {
    padding: 14px 18px 8px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    align-items: center;
    text-align: center;
}

.model-picker-list {
    max-height: 360px;
    overflow-y: auto;
    padding: 4px 10px 12px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
    mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
}

.model-picker-list::-webkit-scrollbar {
    width: 4px;
}

.model-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
}

.model-picker-item:hover {
    background: var(--surface2);
}

.model-picker-item.selected {
    background: var(--surface2);
}

.mpi-info {
    flex: 1;
}

.mpi-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fg);
}

.mpi-sub {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 2px;
}

.mpi-check {
    color: var(--fg);
    flex-shrink: 0;
    opacity: 0;
    font-size: 13px;
}

.model-picker-item.selected .mpi-check {
    opacity: 1;
}

.images-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    scrollbar-width: thin;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

.images-wrap::-webkit-scrollbar {
    width: 5px;
}

.page-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--fg);
    align-items: center;
    text-align: center;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--muted);
    margin-top: 6px;
}

.image-gen-input-wrap {
    margin-bottom: 28px;
}

.image-gen-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border-radius: 50px;
    padding: 10px 12px 10px 16px;
}

.image-gen-box:focus-within {
    border-color: var(--surface3);
    box-shadow: var(--shadow-md);
}

.image-gen-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9375rem;
    color: var(--fg);
    line-height: 1.5;
    padding: 8px 0;
}

.image-gen-input::placeholder {
    color: var(--light);
}

.img-gen-icon-btn,
.img-gen-voice-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    flex-shrink: 0;
}

.img-gen-icon-btn:hover,
.img-gen-voice-btn:hover {
    background: var(--surface2);
    color: var(--fg);
}

.img-gen-send {
    width: 38px;
    height: 38px;
    border-radius: 50px;
    background: var(--fg);
    color: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}

.img-gen-send:hover {
    opacity: 0.85;
}

.image-model-row {
    margin-top: 12px;
    padding: 0 4px;
}

.image-model-select {
    font-size: 0.8125rem;
    color: var(--fg);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    cursor: pointer;
    outline: none;
}

.images-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--fg);
    margin-bottom: 16px;
}

.images-styles {
    margin-bottom: 32px;
}

.styles-scroll {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 8px;
    -webkit-mask-image: linear-gradient(to left, transparent, black 10%, black 90%, transparent);
    mask-image: linear-gradient(to left, transparent, black 10%, black 90%, transparent);
}

.styles-scroll::-webkit-scrollbar {
    height: 4px;
}

.style-card {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: left;
    gap: 8px;
    cursor: pointer;
    width: 110px;
}

.style-card-preview {
    width: 110px;
    height: 150px;
    border-radius: var(--radius-lg);
}

.style-card span {
    font-size: 0.75rem;
    color: var(--fg-muted);
    text-align: center;
    font-weight: 500;
}

.images-discover {
    margin-bottom: 32px;
}

.discover-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.discover-card {
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: var(--radius);
    cursor: pointer;
}

.discover-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.discover-card span {
    font-size: 0.875rem;
    color: var(--fg);
    font-weight: 500;
}

.my-images-section {
    margin-bottom: 32px;
}

.my-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.my-images-empty {
    font-size: 0.875rem;
    color: var(--light);
    padding: 24px 0;
    text-align: center;
}

.my-image-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius);
    display: block;
    cursor: pointer;
    border: 1px solid var(--border);
}

.my-image-thumb:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.image-output-area {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.image-output-inner {
    background: var(--bg);
    border-radius: var(--radius-xl);
    overflow: hidden;
    max-width: 600px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.2s ease;
    position: relative;
}

.image-output-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px;
}

.image-output-loading span {
    font-size: 0.875rem;
    color: var(--muted);
}

.image-output-result img {
    width: 100%;
    display: block;
}

.image-output-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(8px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.image-output-prompt {
    font-size: 0.8125rem;
    color: #ffffff;
}

.image-output-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: pointer;
}

.image-output-close:hover {
    background: var(--surface2);
    color: var(--fg);
}

.models-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    scrollbar-width: none;
}

.models-header {
    margin-bottom: 28px;
}

.loading-state,
.empty-state {
    font-size: 0.875rem;
    color: var(--light);
    padding: 32px;
    text-align: center;
}

.settings-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-modal {
    background: var(--bg);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 800px;
    height: 80vh;
    max-height: 600px;
    box-shadow: var(--shadow-lg);
    display: flex;
    overflow: hidden;
    border: 1px solid var(--border);
}

.settings-modal-sidebar {
    width: 220px;
    flex-shrink: 0;
    padding: 24px 16px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-modal-brand {
    font-size: 1rem;
    font-weight: 700;
    color: var(--fg);
    margin-bottom: 16px;
    padding: 0 6px;
    letter-spacing: -0.01em;
}

.settings-tab {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--fg-muted);
    cursor: pointer;
    text-align: left;
    width: 100%;
    gap: 10px;
}

.settings-tab:hover {
    background: var(--surface2);
    color: var(--fg);
}

.settings-tab.active {
    background: var(--surface2);
    color: var(--fg);
    font-weight: 500;
}

.settings-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    scrollbar-width: thin;
    position: relative;
    background: var(--bg);
}

.settings-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: pointer;
    z-index: 10;
}

.settings-modal-close:hover {
    background: var(--surface);
    color: var(--fg);
}

.settings-section {
    display: none;
}

.settings-section.active {
    display: block;
}

.settings-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--fg);
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
    gap: 20px;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row-label span {
    font-size: 0.9375rem;
    color: var(--fg);
    font-weight: 500;
}

.settings-row-label small {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 4px;
}

.settings-select {
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.875rem;
    color: var(--fg);
    cursor: pointer;
    outline: none;
    flex-shrink: 0;
}

.settings-select:focus {
    border-color: var(--muted);
}

.settings-danger-btn {
    padding: 8px 18px;
    border-radius: var(--radius);
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
}

.settings-danger-btn:hover {
    background: var(--danger);
    color: white;
}

#accountContent {
    padding: 4px 0;
    min-height: 120px;
}

.account-not-logged p {
    font-size: 0.9375rem;
    color: var(--muted);
    margin-bottom: 16px;
}

.account-logged {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.account-logged-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.account-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #19c37d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    flex-shrink: 0;
    overflow: hidden;
}

.account-avatar-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    text-transform: uppercase;
    flex-shrink: 0;
    overflow: hidden;
}

.account-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--fg);
}

.account-email {
    font-size: 0.8125rem;
    color: var(--muted);
    margin-top: 3px;
}

.account-logout-btn {
    width: fit-content;
    padding: 9px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--fg);
    cursor: pointer;
}

.account-logout-btn:hover {
    background: var(--surface);
}

.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    border: 1px solid var(--border);
}

.auth-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: pointer;
}

.auth-close:hover {
    background: var(--surface2);
}

.auth-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--fg);
    letter-spacing: -0.03em;
    margin-bottom: 24px;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.auth-tab {
    padding: 10px 20px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.auth-tab.active {
    color: var(--fg);
    border-bottom-color: var(--fg);
    font-weight: 600;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface2);
    font-size: 0.9375rem;
    color: var(--fg);
    outline: none;
}

.auth-input:focus {
    border-color: var(--muted);
}

.auth-input::placeholder {
    color: var(--light);
}

.auth-error {
    font-size: 0.8125rem;
    color: var(--danger);
    min-height: 20px;
}

.auth-submit {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--fg);
    color: var(--bg);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.auth-submit:hover {
    opacity: 0.85;
}

.auth-disclaimer {
    font-size: 0.75rem;
    color: var(--light);
    margin-top: 16px;
    line-height: 1.5;
    text-align: center;
}

.auth-disclaimer a {
    color: var(--muted);
    text-decoration: underline;
}

.user-popover-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: none;
}

.user-popover-overlay.visible {
    display: block;
}

.user-popover {
    position: fixed;
    bottom: 80px;
    left: 8px;
    width: 280px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    z-index: 501;
    animation: slideUp 0.15s ease;
}

.user-popover-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.user-popover-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #19c37d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9375rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
}

.user-popover-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--fg);
}

.user-popover-plan {
    font-size: 0.75rem;
    color: var(--muted);
}

.user-popover-body {
    padding: 8px;
}

.user-popover-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--fg);
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.user-popover-item:hover {
    background: var(--surface2);
}

.user-popover-item.danger {
    color: var(--danger);
}

.user-popover-item.danger:hover {
    background: rgba(225, 29, 72, 0.1);
    color: var(--danger);
}

.user-popover-sep {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.search-modal {
    background: var(--surface);
    border-radius: 5vh;
    box-shadow: var(--shadow-lg);
    width: 340px;
    overflow: hidden;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 15px;
}

.search-modal-input-wrap {
    border-bottom: 1px solid var(--border);
}

.search-input-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 18px;
    gap: 12px;
}

.search-icon {
    flex-shrink: 0;
    color: var(--muted);
}

#searchInput {
    background: none;
    border: none;
    outline: none;
    padding: 8px 0;
    font-size: 0.9375rem;
    color: var(--fg);
    text-align: center;
    flex: 1;
}

#searchInput::placeholder {
    color: var(--muted);
}

.search-clear-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: pointer;
    flex-shrink: 0;
}

.search-clear-btn:hover {
    background: var(--surface2);
    color: var(--fg);
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
    mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
}

.search-date-group {
    padding: 12px 18px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-item {
    padding: 12px 18px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
}

.search-result-item:hover {
    background: var(--surface2);
}

.search-result-title {
    font-weight: 500;
    color: var(--fg);
    margin-bottom: 4px;
    font-size: 0.875rem;
}

.search-result-snippet {
    color: var(--muted);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-empty-state,
.search-no-results {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.custom-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000;
}

.custom-alert {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.custom-alert-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--fg);
    margin: 0 0 12px;
}

.custom-alert-message {
    font-size: 0.875rem;
    color: var(--muted);
    margin: 0 0 24px;
    line-height: 1.5;
}

.custom-alert-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.custom-alert-cancel-btn,
.custom-alert-confirm-btn {
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
}

.custom-alert-cancel-btn {
    background: var(--surface2);
    color: var(--fg);
}

.custom-alert-cancel-btn:hover {
    background: var(--surface3);
}

.custom-alert-confirm-btn {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.custom-alert-confirm-btn:hover {
    background: var(--danger-hover);
}

.code-block-wrap {
    border-radius: var(--radius);
    overflow: hidden;
    margin: 1em 0;
    background: var(--surface);
    border: 1px solid var(--border);
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 14px;
    background: var(--surface);
    margin-top: 10px;
    padding-right: 14px;
}

.code-lang-label {
    font-size: 0.7em;
    font-family: monospace;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 600;
}

.copy-code-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    padding: 4px 10px;
    font-size: 0.7em;
    cursor: pointer;
}

.copy-code-btn:hover {
    background: var(--surface3);
    color: var(--fg);
}

.code-block-wrap pre {
    margin: 0;
    padding-left: 16px;
    padding-right: 16px;
    padding-top: 0px;
    overflow-x: auto;
}

.msg-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.msg-row.bot:hover .msg-actions {
    opacity: 1;
}

.copy-text-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    padding: 4px 10px;
    font-size: 0.7em;
    cursor: pointer;
}

.copy-text-btn:hover {
    background: var(--surface2);
    color: var(--fg);
}

.markdown-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 16px 0;
}

.markdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    border: 1px solid var(--border);
}

.markdown-table th,
.markdown-table td {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid var(--border);
}

.markdown-table th {
    background: var(--surface2);
    font-weight: 600;
}

.markdown-table tr:hover {
    background: var(--surface3);
}

.avatar-upload-container {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.avatar-upload-label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--fg);
    margin-bottom: 8px;
}

.avatar-upload-input {
    display: block;
    width: 100%;
    font-size: 0.875rem;
    color: var(--fg);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    cursor: pointer;
}

.avatar-upload-input:hover {
    background: var(--surface2);
    border-color: var(--muted);
}

.avatar-upload-input::file-selector-button {
    background: var(--fg);
    color: var(--bg);
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    margin-right: 8px;
}

.avatar-change-hint {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 6px;
    line-height: 1.4;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    cursor: default;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 299;
    display: none;
}

.mobile-overlay.visible {
    display: block;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    background: var(--bg2);
    z-index: 400;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.mobile-drawer.open {
    transform: translateX(0);
}

.mobile-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mobile-drawer-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
}

.mobile-drawer-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: pointer;
}

.mobile-drawer-close:hover {
    background: var(--surface2);
}

.mobile-drawer-nav {
    padding: 8px 12px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mobile-drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--fg);
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.mobile-drawer-nav-item:hover {
    background: var(--surface2);
}

.mobile-drawer-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 12px;
}

.mobile-drawer-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    padding: 8px 16px 4px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mobile-drawer-history {
    flex: 1;
    overflow-y: auto;
    padding: 4px 12px;
}

.mobile-drawer-history .history-item {
    padding: 10px 8px;
}

.mobile-drawer-foot {
    padding: 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.mobile-drawer-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.mobile-drawer-user:hover {
    background: var(--surface2);
}

.mobile-drawer-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #19c37d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
}

.mobile-drawer-user-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--fg);
}

.mobile-drawer-user-plan {
    font-size: 0.75rem;
    color: var(--muted);
}

.mobile-login-row-btn {
    width: 100%;
    padding: 10px;
    border-radius: var(--radius);
    background: var(--fg);
    color: var(--bg);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.hljs-keyword {
    color: #c678dd;
}

.hljs-string {
    color: #98c379;
}

.hljs-comment {
    color: #5c6370;
    font-style: italic;
}

.hljs-number {
    color: #d19a66;
}

.hljs-title {
    color: #61afef;
}

[data-theme="light"] .hljs-keyword {
    color: #9c3dd8;
}

[data-theme="light"] .hljs-string {
    color: #0d7e0d;
}

[data-theme="light"] .hljs-comment {
    color: #6a737d;
    font-style: italic;
}

[data-theme="light"] .hljs-number {
    color: #005cc5;
}

[data-theme="light"] .hljs-title {
    color: #0366d6;
}

.inline-code {
    background: var(--surface2);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.85em;
}

@media (max-width: 680px) {
    .sidebar {
        display: none !important;
    }

    .topbar-expand {
        display: flex !important;
    }
}

@media (orientation: landscape) {
    .input-area {
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
        width: auto !important;
        max-width: 500px !important;
    }
}

@media (max-height: 909px) {
    .mobile-drawer {
        width: 100%;
        background: var(--bg);
    }

    .mobile-drawer-head {
        border-bottom: none;
        padding: 20px 20px 8px;
    }

    .mobile-drawer-logo {
        display: none;
    }

    .mobile-drawer-close {
        display: none;
    }

    .mobile-drawer-nav {
        flex-direction: row;
        gap: 12px;
        padding: 16px 20px 20px;
        border-bottom: 1px solid var(--border);
        justify-content: flex-start;
    }

    .mobile-drawer-nav-item {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        width: 72px;
        height: 80px;
        padding: 12px 8px 8px;
        border-radius: 50%;
        font-size: 0.6875rem;
        font-weight: 500;
        color: var(--fg);
        background: var(--surface);
        width: 72px;
        flex-shrink: 0;
    }

    .mobile-drawer-nav-item:hover {
        background: var(--surface2);
    }

    .mobile-drawer-nav-item i {
        font-size: 0.9rem;
    }

    .mobile-drawer-divider {
        display: none;
    }

    .mobile-drawer-section-label {
        font-size: 1rem;
        font-weight: 700;
        color: var(--fg);
        padding: 16px 20px 8px;
        text-transform: none;
        letter-spacing: 0;
    }

    .mobile-drawer-history {
        padding: 0 8px;
        max-height: none;
    }

    .mobile-drawer-history .history-item {
        padding: 12px 12px;
        font-size: 1rem;
        border-radius: 0;
        border-bottom: none;
        margin-bottom: 0;
    }

    .mobile-drawer-history .history-item-text {
        font-size: 1rem;
        font-weight: 400;
    }

    .mobile-drawer-history .history-item-del {
        display: none;
    }

    .mobile-drawer-foot {
        border-top: 1px solid var(--border);
        padding: 16px 20px;
    }

    .mobile-drawer-user {
        padding: 10px 0;
    }

    .mobile-login-row-btn {
        background: var(--surface2);
        color: var(--fg);
        border-radius: 14px;
        font-size: 1rem;
        font-weight: 500;
        padding: 14px;
    }
}

@media (max-width: 680px) {
    .mobile-drawer {
        width: 100%;
        background: var(--bg);
    }

    .mobile-drawer-head {
        border-bottom: none;
        padding: 20px 20px 8px;
    }

    .mobile-drawer-logo {
        display: none;
    }

    .mobile-drawer-close {
        display: none;
    }

    .mobile-drawer-nav {
        flex-direction: row;
        gap: 12px;
        padding: 16px 20px 20px;
        border-bottom: 1px solid var(--border);
        justify-content: flex-start;
    }

    .mobile-drawer-nav-item {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 16px 8px 10px;
        border-radius: 50%;
        font-size: 0.6875rem;
        font-weight: 500;
        color: var(--fg);
        background: var(--surface);
        width: 72px;
        height: 72px;
        flex-shrink: 0;
        text-align: center;
    }

    .mobile-drawer-nav-item:hover {
        background: var(--surface2);
    }

    .mobile-drawer-nav-item i {
        font-size: 20px;
    }

    .mobile-drawer-divider {
        display: none;
    }

    .mobile-drawer-section-label {
        font-size: 1rem;
        font-weight: 700;
        color: var(--fg);
        padding: 16px 20px 8px;
        text-transform: none;
        letter-spacing: 0;
    }

    .mobile-drawer-history {
        padding: 0 8px;
    }

    .mobile-drawer-history .history-item {
        padding: 12px 12px;
        border-radius: 0;
        margin-bottom: 0;
    }

    .mobile-drawer-history .history-item-text {
        font-size: 1rem;
        font-weight: 400;
    }

    .mobile-drawer-history .history-item-del {
        display: none;
    }

    .mobile-drawer-foot {
        border-top: 1px solid var(--border);
        padding: 16px 20px;
    }

    .mobile-drawer-user {
        padding: 10px 0;
    }

    .mobile-login-row-btn {
        background: var(--surface2);
        color: var(--fg);
        border-radius: 14px;
        font-size: 1rem;
        font-weight: 500;
        padding: 14px;
    }
}

.style-card {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    width: 110px;
}

.style-card-preview {
    width: 110px;
    height: 150px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

.style-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
    display: block;
}

.discover-card {
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: var(--radius);
    cursor: pointer;
    padding: 6px 8px;
}

.discover-card:hover {
    background: var(--surface);
}

.discover-thumb {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    flex-shrink: 0;
    overflow: hidden;
}

.discover-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
    display: block;
}

.topbar-expand {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

button.topbar-expand.visible {
    display: flex !important;
}

.topbar-expand.visible {
    display: flex !important;
}

@media (max-height: 909px) {
    .sidebar {
        display: none !important;
    }

    .topbar {
        height: 56px;
        padding: 0 16px;
    }

    .topbar-expand {
        display: flex !important;
    }

    .topbar-title {
        position: absolute;
        left: 56px;
        font-size: 0.9375rem;
    }

    .toast {
        border: none !important;
    }

    .feed {
        padding-bottom: 130px;
    }

    .mobile-drawer {
        height: 100vh;
        max-height: 100vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .mobile-drawer {
        height: 100vh;
        max-height: 100vh;
        top: 0;
    }

    .mobile-drawer-history {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding: 4px 12px;
        margin-bottom: 0;
        max-height: calc(100vh - 250px);
    }

    .mobile-drawer-nav {
        flex-shrink: 0;
        padding: 8px 12px;
        margin-bottom: 0;
    }

    .mobile-drawer-foot {
        flex-shrink: 0;
        padding: 12px;
        margin-top: 0;
        border-top: 1px solid var(--border);
        height: auto;
    }

    .feed-empty-title {
        font-size: 1.8rem;
        padding: 0 20px;
    }

    .input-area {
        padding: 12px 16px max(20px, env(safe-area-inset-bottom));
    }

    #inp {
        font-size: 0.9375rem;
    }

    .input-row {
        display: flex;
    }

    .input-disclaimer {
        display: none;
    }

    .msg-row {
        padding: 4px 16px;
    }

    .user-bub {
        max-width: 85%;
        font-size: 0.875rem;
    }

    .images-wrap {
        padding: 20px;
    }

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

    .my-images-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .markdown-table {
        font-size: 12px;
        word-wrap: break-word;
        table-layout: fixed;
    }

    .markdown-table th,
    .markdown-table td {
        padding: 8px 6px;
        word-wrap: break-word;
        white-space: normal;
        line-height: 1.3;
    }

    .settings-modal-overlay {
        align-items: flex-end;
    }

    .settings-modal {
        width: 100%;
        height: 85vh;
        max-width: 100%;
        border-radius: 28px 28px 0 0;
        flex-direction: column;
    }

    .settings-modal-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding: 16px;
        border-right: none;
    }

    .settings-modal-brand {
        display: none;
    }

    .settings-modal-body {
        padding: 20px;
    }
}

.mobile-input-actions {
    display: none;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 400px;
}

.toast {
    background: var(--surface);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 14px 16px;
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: all;
    animation: toastSlideIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transition: all 0.2s ease;
    position: relative;
}

.toast.removing {
    animation: toastSlideOut 0.25s cubic-bezier(0.55, 0.055, 0.675, 0.19);
    opacity: 0;
    transform: translateX(20px) scale(0.96);
}

.toast-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 500;
    opacity: 0.85;
}

.toast-icon.info {
    background: var(--muted);
    color: var(--bg);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fg);
    margin-bottom: 2px;
    line-height: 1.25;
    letter-spacing: -0.005em;
}

.toast-message {
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.4;
    font-weight: 400;
}

.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    opacity: 0.5;
    font-size: 10px;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--fg);
    opacity: 0.8;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    to {
        transform: translateX(100%) scale(0.95);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .toast {
        border: none;
        margin-top: 60px;
    }

    .toast-container {
        top: 12px;
        right: 12px;
        left: auto;
        gap: 8px;
        max-width: 300px;
        flex-direction: row-reverse;
        padding-right: 12px;
    }

    .toast-icon {
        width: 16px;
        height: 16px;
        font-size: 9px;
    }

    .toast-title {
        font-size: 0.8125rem;
        margin-bottom: 1px;
    }

    .toast-message {
        font-size: 0.6875rem;
        line-height: 1.3;
    }

    .toast-close {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .toast-container {
        top: 8px;
        right: 8px;
        gap: 6px;
    }

    .toast-icon {
        width: 14px;
        height: 14px;
        font-size: 8px;
    }

    .toast-title {
        font-size: 0.75rem;
    }

    .toast-message {
        font-size: 0.625rem;
        line-height: 1.25;
    }

    .markdown-table {
        font-size: 11px;
    }

    .markdown-table th,
    .markdown-table td {
        padding: 6px 4px;
        line-height: 1.2;
    }
}

@media (max-width: 430px) {
    .markdown-table {
        font-size: 10px;
    }

    .markdown-table th,
    .markdown-table td {
        padding: 5px 3px;
        line-height: 1.1;
    }
}

@media (max-width: 390px) {
    .markdown-table {
        font-size: 9px;
    }

    .markdown-table th,
    .markdown-table td {
        padding: 4px 2px;
        line-height: 1.0;
    }
}

@media (max-width: 390px) and (max-height: 844px) {
    .toast-container {
        top: 6px;
        right: 6px;
        gap: 4px;
    }

    .toast-icon {
        width: 12px;
        height: 12px;
        font-size: 7px;
    }

    .toast-title {
        font-size: 0.6875rem;
    }

    .toast-message {
        font-size: 0.5625rem;
        line-height: 1.2;
    }

    .toast-close {
        width: 14px;
        height: 14px;
        font-size: 7px;
    }
}

.mobile-drawer-grid {
    display: flex;
    flex-direction: row;
    gap: 12px;
    padding: 12px 16px 16px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.mobile-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--surface);
    border: none;
    cursor: pointer;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--fg);
    font-family: var(--font);
    flex-shrink: 0;
    transition: var(--transition);
}

.mobile-grid-item:hover {
    background: var(--surface2);
}

.mobile-grid-icon {
    font-size: 1rem;
    color: var(--fg);
}

.mobile-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px 8px;
    border-bottom: none;
    flex-shrink: 0;
}

.mobile-drawer-foot {
    display: none !important;
}

.msg-ctx-menu {
    position: fixed;
    background: var(--surface2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    z-index: 9999;
    overflow: hidden;
    min-width: 180px;
    animation: slideUp 0.15s ease;
}

.msg-ctx-time {
    font-size: 0.75rem;
    color: var(--muted);
    padding: 8px 14px 6px;
    border-bottom: 1px solid var(--border);
}

.msg-ctx-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    font-size: 0.875rem;
    color: var(--fg);
    cursor: pointer;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font-family: var(--font);
    transition: background 0.1s;
}

.msg-ctx-item:hover {
    background: var(--surface3);
}

.edit-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--surface2);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-size: 0.8125rem;
    color: #4a9eff;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.edit-indicator span {
    flex: 1;
}