@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');

body {
    margin: 0;
    padding: 0;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', sans-serif;
    background-color: #000000;
    overflow: hidden;
    overflow-x: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: 100vw;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    top: 0;
    left: 0;
    right: 0;
}

html {
    touch-action: pan-y;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    overflow: hidden;
    overflow-x: hidden;
    height: 100%;
    height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overscroll-behavior-x: none;
}

* {
    -webkit-tap-highlight-color: transparent;
}

body::before {
    content: "";
    position: fixed;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    pointer-events: none;
    background-color: #000000;
    z-index: -1;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 7.5vh;
    height: 100vh;
    height: 100dvh;
    background: #000000;
    backdrop-filter: blur(90px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.expanded {
    width: 36vh;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    padding: 16px 4px;
    gap: 4px;
    flex: 1;
    overflow: hidden;
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    padding: 16px 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.5vh 12px;
    
    padding-left: 1.1vh;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    min-height: 48px;
    position: relative;
}

.sidebar-item.active .sidebar-icon {
    color: #fff;
}

.sidebar-item.active .sidebar-text {
    color: #fff;
}

.sidebar-icon {
    width: 4.5vh;
    height: 4.5vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: color 0.2s ease, filter 0.2s ease;
    border-radius: 10px;
    flex-shrink: 0;
}

.sidebar-clear-icon {
    width: 4.5vh;
    height: 4.5vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: color 0.2s ease, filter 0.2s ease;
    border-radius: 10px;
    flex-shrink: 0;
}

.sidebar-clear-icon-img {
    width: 4.5vh;
    height: 4.5vh;
    opacity: 1;
    justify-content: center;
    transition: opacity 0.2s ease, filter 0.2s ease;
    filter: brightness(0) invert(1);
    display: block;
}

.sidebar-adi-icon-img {
    width: 6.5vh;
    height: 6.5vh;
    opacity: 1;
    justify-content: center;
    transition: opacity 0.2s ease, filter 0.2s ease;
    filter: brightness(0) invert(1);
    display: block;
}

.sidebar-settings-icon-img {
    width: 4.7vh;
    height: 4.7vh;
}

.sidebar-adi-icon {
    width: 6.5vh;
    height: 6.5vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: color 0.2s ease, filter 0.2s ease;
    border-radius: 10px;
    flex-shrink: 0;
}

.sidebar-icon-img {
    width: 4.5vh;
    height: 4.5vh;
    opacity: 1;
    transition: opacity 0.2s ease, filter 0.2s ease;
    filter: brightness(0) invert(1);
    display: block;
}

.sidebar-icon.active {
    color: #fff;
}

.sidebar-text {
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.toggle-item .sidebar-icon {
    color: #ffffff;
}

.toggle-item:hover .sidebar-icon {
    color: #ffffff;
}

.sidebar-top > .sidebar-item:nth-child(2) .sidebar-text {
    margin-left: 7px;
}

.sidebar-item:has(.sidebar-adi-icon) .sidebar-icon {
    width: 6.5vh;
    height: 6.5vh;
}

.sidebar-item:has(.sidebar-adi-icon) {
    padding-left: 0.1vh;
}

.sidebar:not(.expanded) .sidebar-text {
    opacity: 0;
    width: 0;
    margin-left: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.expanded .sidebar-text {
    opacity: 1;
    width: auto;
    margin-left: 0;
    transition: opacity 0.25s 0.1s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.upgrade-item {
    position: fixed;
    top: calc(16px + var(--viewport-top, 0px));
    right: 20px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(20, 18, 8, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(40, 34, 12, 0.75);
    cursor: pointer;
    transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.upgrade-item:hover {
    background: rgba(47, 41, 14, 0.75);
    border-color: rgba(240, 208, 96, 0.6);
}

.upgrade-item:active {
    transform: scale(0.97);
}

.upgrade-icon {
    width: 18px;
    height: 18px;
    color: #d4af37;
    filter: drop-shadow(0 0 3px rgba(212, 175, 55, 0.4));
    flex-shrink: 0;
}

.upgrade-text {
    color: #d4af37;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.upgrade-item:hover .upgrade-text {
    color: #f0d060;
}

.logo-item {
    margin-bottom: 12px;
    pointer-events: none;
}

.logo-img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: #fff !important;
    letter-spacing: -0.5px;
}

.sidebar-chats {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 8px;
    padding-right: 4px;
}

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

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

.sidebar-chats::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.5px;
    padding: 12px 12px 8px;
}

.chat-item {
    padding: 8px 12px;
    min-height: 44px;
}

.chat-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
}

.chat-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
}

.delete-chat-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    position: absolute;
    right: 8px;
}

.sidebar.expanded .chat-item:hover .delete-chat-btn {
    opacity: 1;
}

.delete-chat-btn:hover {
    background: transparent;
    color: #ffffff;
}

.sidebar-toggle {
    display: none;
}

.main-content-wrapper {
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 60px;
    width: calc(100% - 60px);
}

.main-content-wrapper.sidebar-open {
    margin-left: 280px;
    width: calc(100% - 280px);
}

.action-btn {
    display: flex;
    align-items: center;
    background-color: #0f0f0f;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 15px 20px;
    color: #999;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    height: 50px;
}

.action-btn:hover {
    background-color: #1a1a1a;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    color: #ccc;
}

.action-btn.active {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
    background: linear-gradient(145deg, #1a1a1a, #0f0f0f);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
}

.action-btn img {
    width: 20px;
    height: 20px;
    margin-right: 2px;
    opacity: 0.8;
}

.search-btn {
    z-index: 9999;
    height: 50px;
}

.search-btn.active {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
    background: linear-gradient(145deg, #1a1a1a, #0f0f0f);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
}

.dot-animation {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.dot {
    width: 0.3rem;
    height: 0.3rem;
    background-color: #ffffff;
    border-radius: 50%;
    opacity: 0;
    animation: dotAnimation 1.5s infinite;
}

.dot:nth-child(1) { animation-delay: 0.1s; }
.dot:nth-child(2) { animation-delay: 0.3s; }
.dot:nth-child(3) { animation-delay: 0.5s; }

@keyframes dotAnimation {
    0%, 100% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.input-area {
    position: fixed;
    bottom: var(--keyboard-offset, 0px);
    left: 60px;
    right: 0;
    padding: 0;
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-area::before {
    content: '';
    position: absolute;
    top: -40px;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent, #000000 40px);
    z-index: -1;
    pointer-events: none;
}

.input-area::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: -100px;
    background-color: #000000;
    z-index: -1;
    pointer-events: none;
}

.main-content-wrapper.sidebar-open .input-area {
    left: 280px;
}

.input-container {
    position: relative;
    width: 62%;
    max-width: 740px;
    background-color: #0a0a0a;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    padding-bottom: 3rem;
    overflow: hidden;
}

.input-container.drag-over {
    border-color: rgba(255, 255, 255, 0.15);
}

.input-placeholder {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #666;
    pointer-events: none;
    font-size: 16px;
    font-family: 'Manrope', sans-serif;
    z-index: 1;
}

.input-field {
    width: 100%;
    min-height: 60px;
    max-height: 200px;
    padding: 20px 20px 0 20px;
    background: transparent;
    border: none;
    outline: none;
    color: #ccc;
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    resize: none;
    overflow-y: auto;
    box-sizing: border-box;
    margin-bottom: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.input-field::-webkit-scrollbar {
    width: 6px;
}

.input-field::-webkit-scrollbar-track {
    background: transparent;
}

.input-field::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.input-bottom-panel {
    position: absolute;
    bottom: 3px;
    left: 0;
    right: 0;
    height: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    background-color: #0a0a0a;
}

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

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

.input-bottom-panel .action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 40px;
}

.input-bottom-panel .action-btn:hover {
    background-color: #1a1a1a;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    color: #ccc;
}

.input-bottom-panel .action-btn img {
    width: 16px;
    height: 16px;
}

.model-selector {
    position: relative;
}

.model-selector-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    height: 40px;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: #999;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.model-selector-trigger:hover {
    background-color: #1a1a1a;
    color: #ccc;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.model-selector-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.model-selector-chevron {
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.7;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.model-selector.open .model-selector-chevron {
    transform: rotate(180deg);
}

.model-selector-menu {
    position: fixed;
    min-width: 220px;
    max-width: 280px;
    max-height: 60vh;
    overflow-y: auto;
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    padding: 6px;
    backdrop-filter: blur(8px);
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    z-index: 10000;
    transform-origin: bottom right;
    animation: modelMenuIn 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modelMenuIn {
    from { opacity: 0; transform: translateY(6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.model-selector-menu::-webkit-scrollbar {
    width: 6px;
}

.model-selector-menu::-webkit-scrollbar-track {
    background: transparent;
}

.model-selector-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

.model-selector-group-title {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    letter-spacing: 0.5px;
    padding: 10px 10px 4px;
}

.model-selector-group-title:first-child {
    padding-top: 4px;
}

.model-selector-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    color: #ccc;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.model-selector-option:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.model-selector-option.active {
    color: #fff;
}

.model-selector-option-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-selector-check {
    color: #ccc;
    flex-shrink: 0;
}

.send-message, .stop-message {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-message:hover, .stop-message:hover {
    background-color: #1a1a1a;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.send-message img, .stop-message img {
    width: 30px;
    height: 30px;
}

.stop-message:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.chat-title-bar {
    position: fixed;
    top: 12px;
    left: 76px;
    z-index: 50;
    display: flex;
    align-items: center;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content-wrapper.sidebar-open .chat-title-bar {
    left: 296px;
}

.chat-title-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 360px;
    padding: 5px 8px;
    margin: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-primary, #e8e8e8);
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
    cursor: text;
    text-align: left;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chat-title-button:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.chat-title-button:focus-visible {
    outline: none;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.18);
}

.chat-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.chat-title-chevron {
    flex-shrink: 0;
    color: #ffffff;
    opacity: 0.85;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-title-button:hover .chat-title-chevron {
    opacity: 1;
}

.chat-title-input {
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: #ffffff;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
    outline: none;
    box-sizing: content-box;
}

.chat-title-input:focus {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
}

.chat-title-measure {
    position: absolute;
    top: 0;
    left: -9999px;
    visibility: hidden;
    pointer-events: none;
    white-space: pre;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.chat-container {
    position: fixed;
    top: 25px;
    bottom: var(--keyboard-offset, 0px);
    width: 85%;
    left: calc(50% + 28px);
    transform: translateX(-50%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    padding: 20px;
    padding-bottom: calc(var(--chat-bottom-padding, 180px) + env(safe-area-inset-bottom, 0px));
    z-index: 10;
    scrollbar-width: none;
    -ms-overflow-style: none;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

li {
    margin-left: 5vh;
}

.main-content-wrapper.sidebar-open .chat-container {
    left: calc(50% + 140px);
    width: calc(100% - 280px - 80px);
}

.chat-container::-webkit-scrollbar {
    display: none;
}

.messages-container {
    width: 60%;
    max-width: 720px;
    margin: 0 auto;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-anim-enter-from {
    opacity: 0;
    transform: translateY(20px);
}

.message-anim-enter-active {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.message-anim-enter-to {
    opacity: 1;
    transform: translateY(0);
}

.message {
    padding: 12px 18px;
    border-radius: 16px;
    margin: 3px 0;
    overflow-wrap: anywhere;
    transition: all 0.3s ease;
    
    content-visibility: auto;
    contain-intrinsic-size: auto 120px;
}

.user-message {
    align-self: flex-end;
    max-width: 70%;
    background-color: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    font-family: 'Manrope', sans-serif;
    border-bottom-right-radius: 4px;
    margin-left: auto;
    position: relative;
}

.assistant-message {
    align-self: flex-start;
    max-width: 100%;
    color: #b0b0b0;
    font-family: 'Manrope', sans-serif;
    border-bottom-left-radius: 4px;
    margin-right: auto;
    position: relative;
}

.message-content {
    margin-bottom: 8px;
    line-height: 1.5;
    font-size: 16px;
}

.message-content.collapsible {
    max-height: 260px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.message-content.collapsible.expanded {
    max-height: 5000px;
}

.message-content.collapsible::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 90px;
    background: linear-gradient(to bottom, rgba(10, 10, 10, 0), #0a0a0a 85%);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.message-content.collapsible.expanded::after {
    opacity: 0;
}

.show-more-btn {
    align-self: flex-end;
    margin: 2px 4px 6px 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    color: #999;
    font-size: 13px;
    font-family: 'Manrope', sans-serif;
    cursor: pointer;
    transition: color 0.2s ease;
}

.show-more-btn:hover {
    color: #fff;
}

.message-actions {
    display: flex;
    gap: 12px;
    opacity: 1;
    justify-content: flex-start;
    margin-top: 8px;
    transition: opacity 0.2s ease;
    transform: translateX(-6px);
}

.message.assistant-message .message-actions {
    opacity: 1;
}

.message.user-message .message-actions {
    opacity: 0;
}

.message.user-message:hover .message-actions {
    opacity: 1;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.action-button {
    border: none;
    border-radius: 50%;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
}

.copy-button::before {
    content: "";
    background-color: transparent;
    background-image: url('/files/image_copy.png');
    background-size: contain;
    background-repeat: no-repeat;
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    transition: background-image 0.3s ease;
    opacity: 0.7;
}

.copy-button.copied::before {
    background-image: url('/files/image_ok.png');
}

.retry-button::before {
    content: "";
    background-image: url('/files/image_retry.png');
    background-size: contain;
    background-repeat: no-repeat;
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    opacity: 0.7;
}

.download-button::before {
    content: "";
    background-image: url('/files/image_download.png');
    background-size: contain;
    background-repeat: no-repeat;
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    opacity: 0.7;
}

.download-button:hover::before,
.download-button:active::before {
    opacity: 1;
}

.tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: max-content;
    max-width: 200px;
    background: rgba(0, 0, 0, 0.9);
    color: #ccc;
    text-align: center;
    border-radius: 8px;
    padding: 8px 12px;
    position: absolute;
    z-index: 10;
    bottom: -50%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.4);
    font-size: 14px;
    white-space: nowrap;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.custom-link {
    color: #666;
    text-decoration: none;
    transition: all 0.2s ease;
    padding-bottom: 1px;
}

a {
    color: #666;
}

.generating-message {
    font-family: 'Manrope', sans-serif;
    color: #666;
    font-size: 16px;
    text-align: center;
    margin: 20px 0;
    padding: 10px;
}

.code-block-wrapper {
    position: relative;
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    background: #050507;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #0c0c0c;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.code-language {
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #8b949e;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.code-copy-btn {
    border: none;
    border-radius: 50%;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
    padding: 0;
}

.code-copy-btn::before {
    content: "";
    background-color: transparent;
    background-image: url('/files/image_copy.png');
    background-size: contain;
    background-repeat: no-repeat;
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    transition: background-image 0.3s ease;
    opacity: 0.7;
}

.code-copy-btn:hover::before {
    opacity: 1;
}

.code-copy-btn.copied::before {
    background-image: url('/files/image_ok.png');
}

.code-block-wrapper pre {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
}

.code-block-wrapper code {
    display: block;
    padding: 16px !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
    overflow-x: auto;
    tab-size: 4;
}

.inline-code {
    background: black;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    color: #e6edf3;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hljs {
    background: #0c0c0c !important;
    color: #e6edf3 !important;
}

.hljs-comment,
.hljs-quote {
    color: #8b949e;
    font-style: italic;
}

.mermaid-source {

    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    margin: 16px 0;
    padding: 0;
    overflow: visible;
}

.mermaid-svg {
    text-align: center;
    padding: 0;
    background: transparent;
    overflow-x: auto;
}

.mermaid-svg svg {

    display: inline-block;
    vertical-align: top;
    max-width: 100% !important;
    width: 100%;
    height: auto;
}

.mermaid-svg.pie-chart svg {
    width: 720px;
    max-width: 100%;
}

.mermaid-svg.column-chart svg {
    max-width: 640px;
    max-height: 360px;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-addition {
    color: #ff7b72;
}

.hljs-string,
.hljs-doctag,
.hljs-regexp {
    color: #a5d6ff;
}

.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-variable,
.hljs-tag .hljs-attr {
    color: #79c0ff;
}

.hljs-function,
.hljs-title,
.hljs-section {
    color: #d2a8ff;
}

.hljs-built_in,
.hljs-builtin-name {
    color: #ffa657;
}

.hljs-type,
.hljs-class .hljs-title {
    color: #7ee787;
}

.hljs-attr,
.hljs-attribute {
    color: #79c0ff;
}

.hljs-symbol,
.hljs-bullet,
.hljs-subst,
.hljs-meta {
    color: #ffa657;
}

.hljs-deletion {
    color: #ffa198;
    background: rgba(248, 81, 73, 0.1);
}

.hljs-addition {
    color: #7ee787;
    background: rgba(46, 160, 67, 0.1);
}

.hljs-emphasis {
    font-style: italic;
}

.hljs-strong {
    font-weight: bold;
}

.hljs-link {
    color: #58a6ff;
    text-decoration: underline;
}

.hljs-ln-numbers {
    color: #484f58;
    padding-right: 16px !important;
    text-align: right;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    margin-right: 16px;
    user-select: none;
}

.code-block-wrapper code::-webkit-scrollbar {
    height: 8px;
}

.code-block-wrapper code::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.code-block-wrapper code::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.code-block-wrapper code::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.error-container {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #4a0000;
    color: #ccc;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    font-size: 16px;
    font-weight: bold;
    display: none;
    z-index: 1000;
    max-width: 300px;
    line-height: 1.5;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.error-container.show {
    display: block;
    opacity: 1;
    animation: fadeInOut 5s forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

.image-container {
    display: flex;
    justify-content: flex-start;
    margin: 15px 0;
    width: 100%;
}

.image-download-btn {
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.image-download-btn img {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.image-download-btn:hover img {
    opacity: 1;
}

.image-placeholder {
    background-color: #0a0a0a;
    width: 25vw;
    height: 25vw;
    max-width: 25vw;
    max-height: 25vw;
    border-radius: 16px;
    -webkit-border-radius: 16px;
    overflow: hidden;
}

.shimmer-animation {
    position: relative;
    overflow: hidden;
    background-color: #1a1a1a;
    color: #ccc;
    border-radius: 16px;
    -webkit-border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: 'Courier New', Courier, monospace;
    box-sizing: border-box;
    width: 25vw;
    height: 25vw;
    max-width: 25vw;
    max-height: 25vw;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    transform: translateZ(0);
}

.shimmer-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.03) 40%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.03) 60%,
        transparent 100%
    );
    background-size: 200% 100%;
    pointer-events: none;
    animation: scanner 2s linear infinite;
    filter: blur(4px);
}

@keyframes scanner {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.image-item {
    display: block;
    width: 25vw;
    height: 25vw;
    max-width: 25vw;
    max-height: 25vw;
    border-radius: 16px;
    -webkit-border-radius: 16px;
    overflow: hidden;
    box-sizing: border-box;
    cursor: zoom-in;
    transition: transform 0.2s ease;
    transform: translateZ(0);
    flex-shrink: 0;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.image-item img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border-radius: 16px;
    -webkit-border-radius: 16px;
    object-fit: cover;
    box-sizing: border-box;
    display: block;
}

@media (max-width: 768px) {
    .image-placeholder,
    .shimmer-animation,
    .image-item {
        width: 75vw !important;
        height: 75vw !important;
        max-width: 75vw !important;
        max-height: 75vw !important;
        min-width: 75vw !important;
        min-height: 75vw !important;
        aspect-ratio: 1 / 1 !important;
        border-radius: 16px !important;
        -webkit-border-radius: 16px !important;
        overflow: hidden !important;
        -webkit-mask-image: -webkit-radial-gradient(white, black) !important;
        transform: translateZ(0) !important;
        box-sizing: border-box !important;
    }

    .image-container {
        max-width: 100%;
        overflow: hidden;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.uploaded-files-preview-area {
    display: flex;
    flex-direction: row;
    gap: 12px;
    padding: 12px 20px 12px 20px;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 0;
}

.uploaded-files-preview-area::-webkit-scrollbar {
    height: 4px;
}

.uploaded-files-preview-area::-webkit-scrollbar-track {
    background: transparent;
}

.uploaded-files-preview-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.file-preview-item {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.file-preview-item.clickable {
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.file-preview-item.clickable:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background-color: rgba(255, 255, 255, 0.07);
}

.file-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-icon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 4px;
    box-sizing: border-box;
}

.file-preview-icon {
    width: 32px;
    height: 32px;
    opacity: 0.7;
}

.file-preview-name {
    font-size: 10px;
    color: #888;
    margin-top: 4px;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.remove-file-preview-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.file-preview-item:hover .remove-file-preview-btn {
    opacity: 1;
}

.remove-file-preview-btn:hover {
    background: rgba(178, 178, 178, 0.7);
}

.settings-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background-color: rgb(15, 15, 15);
    backdrop-filter: blur(10px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
}

.settings-panel-overlay.active {
    opacity: 1;
    visibility: visible;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(10px);
}

.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 750px;
    height: 500px;
    background-color: rgb(15, 15, 15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.settings-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.settings-panel-container {
    display: flex;
    height: 100%;
}

.settings-sidebar {
    width: 200px;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-menu-item {
    position: relative;
    padding: 14px 24px;
    color: #666;
    cursor: pointer;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.settings-menu-item:hover {
    color: #ffffff;
}

.settings-menu-item.active {
    color: #fff;
}

.settings-menu-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.settings-content {
    flex: 1;
    padding: 30px;
    background: rgba(0, 0, 0, 0.4);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.settings-content::-webkit-scrollbar {
    display: none;
}

.settings-section {
    display: none;
    animation: fadeInSection 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

@keyframes fadeInSection {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-section h3 {
    color: #fff;
    margin: 0 0 24px 0;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-section label {
    display: block;
    color: #999;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.system-prompt-container {
    position: fixed;
    height: 400px;
}

.system-prompt-textarea {
    width: 67vh;
    height: 80%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    color: #ccc;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    box-sizing: border-box;
}

.system-prompt-textarea::-webkit-scrollbar {
    display: none;
}

.system-prompt-textarea:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.8);
}

.image-model-selector {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 14px 16px;
    color: #ccc;
    font-size: 14px;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    box-sizing: border-box;
}

.image-model-selector:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.image-model-selector:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.image-model-selector optgroup {
    background-color: #0a0a0a;
    color: #666;
    font-weight: 600;
}

.image-model-selector option {
    background: #0a0a0a;
    color: #ccc;
    font-weight: 400;
    padding: 10px;
}

.settings-close-btn {
    position: absolute;
    top: 10px;
    right: 6px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.settings-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.settings-description {
    color: #555;
    font-size: 12px;
    line-height: 1.5;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

.generation-time {
    font-size: 0.8rem;
    opacity: 0.6;
    color: #ffffff;
    cursor: pointer;
    margin-top: 3px;
    transition: opacity 0.2s ease;
    margin-left: 6px;
}

.generation-time:hover {
    opacity: 0.9;
    color: #999;
}

.time-details {
    position: fixed;
    background: rgba(44, 44, 44, 0.9);
    color: #ccc;
    padding: 0.4rem 1rem;
    border-radius: 10px;
    font-size: 0.8rem;
    z-index: 9999 !important;
    width: 6.8rem;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    transform: translateY(-1.2rem) translateX(3rem);
}

.generation-time:hover .time-details {
    opacity: 1;
    visibility: visible;
}

.formatted-content {
    line-height: 1.4;
}

h1 { font-size: 2.5vh; }
h2 { font-size: 2.4vh; }

.formatted-content h1,
.formatted-content h2,
.formatted-content h3,
.formatted-content h4,
.formatted-content h5,
.formatted-content h6,
.formatted-content p,
.formatted-content ul,
.formatted-content ol,
.formatted-content li,
.formatted-content blockquote,
.formatted-content pre {
    margin-top: 0.2em;
    margin-bottom: 0.2em;
}

.formatted-content ul,
.formatted-content ol {
    padding-left: 0.8em;
    margin-left: 0;
}

::placeholder {
    color: #444;
    opacity: 1;
}

:-ms-input-placeholder {
    color: #444;
}

::-ms-input-placeholder {
    color: #444;
}

@media screen and (max-width: 768px) {
    .user-attachment-image {
        max-width: 90px !important;
        max-height: 150px;
        border-radius: 8px;
        object-fit: cover;
        cursor: pointer;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .user-attachment-file {
        max-width: 160px;
        padding: 6px 10px;
    }

    .user-attachment-name {
        font-size: 12px;
    }

    .sidebar {
        transform: translateX(-100%);
        background: #000000;
        width: 17vh;
        z-index: 1001;
    }

    .sidebar.expanded {
        transform: translateX(0);
        width: 275px;
    }

    .sidebar .sidebar-text {
        opacity: 1;
        transform: translateX(0);
    }

    .sidebar .sidebar-section-title {
        opacity: 1;
    }

    .sidebar.expanded .chat-item:hover .delete-chat-btn,
    .sidebar .chat-item:hover .delete-chat-btn {
        opacity: 1;
    }

    .sidebar-toggle {
        display: flex;
        position: fixed;
        left: 20px;
        top: calc(20px + var(--viewport-top, 0px));
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: rgba(15, 15, 15, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.05);
        color: #999;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        z-index: 999;
        transition: all 0.3s ease;
        backdrop-filter: blur(10px);
    }

    .sidebar-toggle:hover {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
        color: #ccc;
    }

    .sidebar-toggle.open {
        opacity: 0;
        pointer-events: none;
    }

    .main-content-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .main-content-wrapper.sidebar-open {
        margin-left: 0;
        width: 100%;
    }

    .chat-container {
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100vw;
        height: auto;
        top: calc(70px + var(--viewport-top, 0px));
        bottom: var(--keyboard-offset, 0px);
        padding: 15px;
        padding-bottom: calc(var(--chat-bottom-padding, 160px) + env(safe-area-inset-bottom, 0px));
        transform: none;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .chat-title-bar {
        left: 76px;
        top: calc(26px + var(--viewport-top, 0px));
    }

    .main-content-wrapper.sidebar-open .chat-title-bar {
        left: 16px;
    }

    .chat-title-button {
        max-width: calc(100vw - 100px);
    }

    .messages-container {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .message {
        max-width: 100%;
        box-sizing: border-box;
    }

    .upgrade-item {
        top: calc(12px + var(--viewport-top, 0px)) !important;
        right: 12px !important;
        padding: 7px 12px;
    }

    .upgrade-item.sidebar-active {
        z-index: 9980;
    }

    .upgrade-icon {
        width: 16px;
        height: 16px;
    }

    .upgrade-text {
        font-size: 12px;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 9990;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar {
        z-index: 9999 !important;
    }

    .settings-panel {
        background: linear-gradient(180deg, #0f0f0f 0%, #050505 100%) !important;
    }

    .settings-content {
        padding: calc(env(safe-area-inset-top, 0px) + 22px) 18px calc(env(safe-area-inset-bottom, 0px) + 60px) !important;
    }

    .settings-section h3 {
        font-size: 16px !important;
        font-weight: 600;
        margin-bottom: 16px;
        color: #fff;
        letter-spacing: 0.2px;
    }

    .settings-field-group {
        margin-bottom: 22px;
        padding: 14px;
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 12px;
    }

    .settings-section label {
        display: block;
        font-size: 13px !important;
        color: #999;
        margin-bottom: 8px;
        letter-spacing: 0.5px;
        font-weight: 500;
    }

    .settings-field-group select,
    .settings-field-group input,
    .settings-field-group textarea {
        width: 100%;
        box-sizing: border-box;
        background: #0a0a0a;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 10px;
        color: #ddd;
        padding: 12px 14px;
        font-size: 15px;
        font-family: inherit;
    }

    .settings-description {
        font-size: 12px !important;
        color: #666;
        margin-top: 8px;
        line-height: 1.4;
    }

    .settings-menu-item {
        font-size: 13px !important;
        padding: 0 16px !important;
    }

    .sidebar-chats {
        max-height: 400px;
    }

    .main-content-wrapper.sidebar-open .chat-container {
        left: 0;
        right: 0;
        width: auto;
        transform: none;
    }

    .input-area {
        left: 0;
    }

    .main-content-wrapper.sidebar-open .input-area {
        left: 0;
    }

    .input-container {
        width: 93%;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 3rem);
    }

    .messages-container {
        width: 100%;
        margin: 0 auto;
    }

    .message {
        max-width: 100%;
        box-sizing: border-box;
    }

    .assistant-message {
        max-width: 100% !important;
        width: 100%;
    }

    .user-message {
        max-width: 80%;
    }

    .settings-panel-overlay {
        background-color: rgba(0, 0, 0, 0.95);
    }

    .settings-panel {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
        background: #0f0f0f;
    }

    .settings-panel.active {
        transform: none;
        animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .settings-sidebar {
        display: none !important;
    }

    .settings-section {
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
        margin-bottom: 28px;
    }

    .settings-panel-container {
        flex-direction: column;
        height: 100%;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .settings-sidebar {
        width: 100%;
        height: 48px;
        min-height: 48px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 0;
        padding: 0;
        background: rgba(0, 0, 0, 0.3);
        position: sticky;
        top: 80px;
        z-index: 1;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .settings-sidebar::-webkit-scrollbar {
        display: none;
    }

    .settings-menu-item {
        padding: 0 20px;
        margin: 0;
        height: 48px;
        white-space: nowrap;
        font-size: 14px;
        font-weight: 500;
        flex-shrink: 0;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: max-content;
        border-bottom: 2px solid transparent;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .settings-menu-item.active::after {
        content: '';
        position: absolute;
        bottom: 0;
        width: 100%;
        height: 2px;
        background: linear-gradient(90deg, transparent, #5e5e5e, transparent);
    }

    .settings-menu-icon {
        display: none;
    }

    .settings-content {
        flex: 1;
        padding: 30px 18px calc(env(safe-area-inset-bottom, 0px) + 60px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .settings-content::-webkit-scrollbar {
        width: 4px;
        display: block;
    }

    .settings-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .settings-content::-webkit-scrollbar-thumb {
        border-radius: 2px;
    }

    .settings-section h3 {
        font-size: 18px;
        margin-bottom: 20px;
        padding-bottom: 12px;
    }

    .settings-section label {
        font-size: 12px;
        margin-bottom: 10px;
        color: #888;
    }

    .settings-close-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
        top: calc(env(safe-area-inset-top, 0px) + 14px) !important;
        right: 14px !important;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 20 !important;
    }

    .settings-close-btn:active {
        background: rgba(166, 166, 166, 0.3);
        transform: scale(0.9);
    }

    .settings-description {
        font-size: 12px;
        padding: 12px;
        border-radius: 8px;
        background: rgba(157, 157, 157, 0.05);
    }

    .system-prompt-container {
        position: static !important;
        height: auto !important;
        width: 100%;
    }

    .system-prompt-textarea {
        position: static !important;
        width: 100% !important;
        height: 200px !important;
        font-size: 14px;
        padding: 14px;
        border-radius: 12px;
        background: rgba(0, 0, 0, 0.5);
        -webkit-tap-highlight-color: transparent;
        box-sizing: border-box;
    }

    .system-prompt-textarea:focus {
        background: rgba(0, 0, 0, 0.7);
    }

    .image-model-selector {
        padding: 14px 16px;
        font-size: 14px;
        border-radius: 12px;
        background: rgba(0, 0, 0, 0.5);
        -webkit-tap-highlight-color: transparent;
    }

    .action-btn span {
        display: none;
    }

    .search-btn span {
        display: none;
    }

    .image-placeholder {
        min-height: 240px;
    }

    .image-item {
        width: min(480px, 92vw);
        max-width: min(480px, 92vw);
        aspect-ratio: 1 / 1;
        border-radius: 16px;
        -webkit-border-radius: 16px;
        overflow: hidden;
        -webkit-mask-image: -webkit-radial-gradient(white, black);
    }

    .image-item img {
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 16px;
        -webkit-border-radius: 16px;
        display: block;
        object-fit: cover;
    }

    .shimmer-animation {
        width: 100%;
        height: 100%;
        border-radius: inherit;
    }

    .time-details {
        position: fixed;
        width: 2rem;
        z-index: 9999 !important;
        transform: translateY(2rem) translateX(-5rem) !important;
    }

    .model-selector-name {
        max-width: 120px;
    }

    .model-selector-menu {
        min-width: 200px;
        max-width: min(280px, 90vw);
    }

    .code-block-wrapper {
        margin: 12px -8px;
        border-radius: 8px;
    }

    .code-block-header {
        padding: 8px 12px;
    }

    .code-block-wrapper code {
        padding: 12px !important;
        font-size: 12px !important;
    }
}

@media screen and (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
        width: 56px;
    }

    .sidebar.expanded {
        width: 260px;
    }

    .main-content-wrapper {
        margin-left: 56px;
        width: calc(100% - 56px);
    }

    .main-content-wrapper.sidebar-open {
        margin-left: 260px;
        width: calc(100% - 260px);
    }

    .chat-container {
        left: calc(50% + 28px);
        width: calc(100% - 56px - 80px);
    }

    .main-content-wrapper.sidebar-open .chat-container {
        left: calc(50% + 130px);
        width: calc(100% - 260px - 80px);
    }

    .input-area {
        left: 56px;
    }

    .main-content-wrapper.sidebar-open .input-area {
        left: 260px;
    }

    .settings-panel {
        width: 85%;
        max-width: 700px;
        height: 85vh;
        max-height: 700px;
    }

    .settings-sidebar {
        width: 180px;
    }

    .settings-content {
        padding: 25px;
    }
}

@media screen and (max-width: 380px) {
    .settings-panel-container {
        padding-top: 30px;
    }

    .settings-sidebar {
        top: calc(env(safe-area-inset-top, 0px) + 52px);
        height: 44px;
        min-height: 44px;
    }

    .settings-menu-item {
        padding: 0 16px;
        height: 44px;
        font-size: 13px;
    }

    .settings-content {
        padding: 30px 16px calc(env(safe-area-inset-bottom, 0px) + 60px);
    }

    .settings-section h3 {
        font-size: 16px;
        margin-bottom: 16px;
    }

    .system-prompt-container {
        height: 250px;
    }

    .system-prompt-textarea {
        font-size: 13px;
        padding: 12px;
    }

    .settings-close-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

@media screen and (max-width: 896px) and (orientation: landscape) {
    .settings-panel-container {
        padding-top: 48px;
    }

    .settings-sidebar {
        top: 48px;
        height: 40px;
        min-height: 40px;
    }

    .settings-menu-item {
        height: 40px;
        font-size: 13px;
        padding: 0 16px;
    }

    .settings-content {
        padding: 16px;
    }

    .system-prompt-container {
        height: 200px;
    }

    .settings-section h3 {
        font-size: 16px;
        margin-bottom: 16px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .settings-close-btn:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.03);
        color: #666;
    }

    .image-model-selector:hover {
        border-color: rgba(255, 255, 255, 0.08);
    }

    .settings-close-btn:active,
    .image-model-selector:active {
        opacity: 0.7;
    }

    .sidebar-item:hover {
        background: transparent;
    }

    .sidebar-item:active {
        background: rgba(255, 255, 255, 0.06);
    }

    .model-selector-trigger:hover {
        background-color: transparent;
        color: #999;
        box-shadow: none;
    }

    .model-selector-trigger:active,
    .model-selector-option:active {
        opacity: 0.7;
    }

    .model-selector-option:hover {
        background-color: transparent;
        color: #ccc;
    }

    .model-selector-option:active {
        background-color: rgba(255, 255, 255, 0.06);
        color: #fff;
    }
}

@media (prefers-color-scheme: dark) {
    .settings-panel {
        background-color: #0a0a0a;
    }
}

@media (prefers-contrast: high) {
    .system-prompt-textarea,
    .image-model-selector {
        border-width: 2px;
    }

    .sidebar {
        border-right-width: 2px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .settings-panel,
    .settings-close-btn,
    .sidebar {
        transition-duration: 0.3s;
    }
}

@media (prefers-reduced-motion: reduce) {
    @keyframes slideUp {
        from, to { transform: translateY(0); }
    }

    @keyframes fadeInSection {
        from, to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes modelMenuIn {
        from, to { opacity: 1; transform: none; }
    }

    .message-anim-enter-active {
        transition: none;
    }

    .message-anim-enter-from {
        opacity: 1;
        transform: none;
    }
}

.math-block {
    display: block;
    margin: 16px 0;
    padding: 16px 20px;
    border-radius: 12px;
    overflow-x: auto;
    text-align: center;
}

.math-block mjx-container {
    margin: 0 auto !important;
}

.math-inline {
    display: inline;
    padding: 2px 6px;
    border-radius: 4px;
    margin: 0 2px;
}

mjx-container {
    font-size: 110% !important;
}

mjx-container[jax="SVG"] {
    direction: ltr;
}

.math-block mjx-container {
    max-width: 100%;
    overflow-x: auto;
}

mjx-container svg {
    color: inherit !important;
}

mjx-container[jax="SVG"] > svg {
    color: inherit;
}

.math-block::-webkit-scrollbar {
    height: 6px;
}

.math-block::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.think-block {
    background: #0c0c0c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin: 12px 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.think-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #0c0c0c;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.think-title {
    font-weight: 600;
    font-size: 13px;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.think-toggle {
    margin-left: auto;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.think-toggle svg {
    width: 16px;
    height: 16px;
    stroke: #ffffff;
}

.think-block.collapsed .think-toggle {
    transform: rotate(-90deg);
}

.think-content {
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.8);
    max-height: 400px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.think-block.collapsed .think-content {
    max-height: 0;
    padding: 0 16px;
    border-top: none;
    overflow: hidden;
}

.think-content::-webkit-scrollbar {
    width: 6px;
}

.think-content::-webkit-scrollbar-track {
    border-radius: 3px;
}

.think-content::-webkit-scrollbar-thumb {
    border-radius: 3px;
}

.user-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-attachment-image {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.user-attachment-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 200px;
}

.user-attachment-file.clickable {
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.user-attachment-file.clickable:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.user-attachment-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.user-attachment-icon-img {
    width: 20px;
    height: 20px;
    display: block;
    flex-shrink: 0;

}

.user-attachment-icon-code {
    display: block;
    flex-shrink: 0;
}

.user-attachment-name {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: zoom-out;
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
}

.text-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 24px;
    box-sizing: border-box;
}

.text-preview-box {
    width: 100%;
    max-width: 820px;
    height: 100%;
    max-height: 86vh;
    background: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.text-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.text-preview-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Manrope', sans-serif;
}

.text-preview-close {
    background: transparent;
    border: none;
    color: #999;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s ease;
}

.text-preview-close:hover {
    color: #fff;
}

.text-preview-content {
    flex: 1;
    margin: 0;
    padding: 16px 20px;
    overflow: auto;
    color: #ccc;
    font-family: 'Fira Code', 'Manrope', monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    -webkit-overflow-scrolling: touch;
}

.text-preview-content code.hljs {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    background: transparent;
    padding: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.text-preview-content::-webkit-scrollbar {
    width: 8px;
}

.text-preview-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.icon {
    width: 3.2vh;
    height: 3.2vh;
    margin-left: 0;
}

.image-error-block {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.image-error-text {
    margin: 0;
    color: #ff6b6b;
}

.image-error-upgrade {
    display: inline;
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    color: #d4af37;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.image-error-upgrade:hover {
    color: #f0d060;
}

.markdown-table-wrapper {
    margin: 16px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    overflow-x: auto;
}

.markdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    color: #e6edf3;
}

.markdown-table th,
.markdown-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
    vertical-align: top;
    white-space: normal;
}

.markdown-table th:last-child,
.markdown-table td:last-child {
    border-right: none;
}

.markdown-table th {
    background: rgba(255, 255, 255, 0.06);
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.2px;
}

.markdown-table tbody tr:last-child td {
    border-bottom: none;
}

.markdown-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

.markdown-table code.inline-code {
    background: #000;
    font-size: 0.85em;
}

.formatted-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 20px 0;
    height: 0;
}

.tos-consent-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
}

.tos-consent-modal {
    background-color: #000000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 30px 36px;
    border-radius: 1rem;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border: 1px solid #2c2c2c;
    color: #e0e0e0;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    box-sizing: border-box;
}

.tos-consent-modal h2 {
    margin: 0 0 16px 0;
    font-size: 1.35rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.3;
}

.tos-consent-modal p {
    font-size: 0.95rem;
    line-height: 1.55;
    color: #a0a0a0;
    margin: 0 0 14px 0;
}

.tos-consent-modal a {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.25s;
}

.tos-consent-modal a:hover {
    color: #e0e0e0;
}

.tos-consent-highlight {
    border-left: 3px solid #ffffff;
    padding: 10px 14px;
    background-color: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    color: #e0e0e0 !important;
}

.tos-consent-warning {
    color: #a0a0a0 !important;
    font-style: italic;
}

.tos-consent-actions {
    display: flex;
    justify-content: center;
    margin-top: 22px;
}

.tos-consent-button {
    background: #ffffff;
    color: #0a0a0a;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.25s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
}

.tos-consent-button:hover:not(:disabled) {
    filter: brightness(1.1);
}

.tos-consent-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.tos-consent-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(10, 10, 10, 0.3);
    border-top-color: #0a0a0a;
    border-radius: 50%;
    animation: tos-consent-spin 0.8s linear infinite;
    display: inline-block;
}

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

.tos-consent-error {
    color: #ff6b6b !important;
    text-align: center;
    margin-top: 14px !important;
}

@media (max-width: 600px) {
    .tos-consent-modal {
        padding: 22px 20px;
    }
    .tos-consent-modal h2 {
        font-size: 1.15rem;
    }
    .tos-consent-modal p {
        font-size: 0.88rem;
    }
    .tos-consent-button {
        width: 100%;
        justify-content: center;
    }
}