.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    position: relative;
}

.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    animation: fadeIn 0.5s ease-in;
}

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

.chat-empty h2 {
    font-size: 24px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, var(--color-cyan), var(--color-pink), var(--color-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.chat-empty p {
    font-size: 11px;
    color: var(--color-gray);
    line-height: 2;
    max-width: 700px;
    text-align: center;
}

.pixel-particles {
    display: none;
}

.particle {
    display: none;
}

.chat-messages {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.chat-messages.active {
    display: flex;
}

.message {
    display: flex;
    gap: 15px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-purple), var(--color-pink));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    border: 2px solid var(--color-cyan);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--color-blue), var(--color-cyan));
}

.message-content {
    flex: 1;
    background: rgba(31, 41, 55, 0.6);
    padding: 15px 20px;
    border-left: 4px solid var(--color-purple);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 18px;
    line-height: 1.6;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}
.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(167, 169, 175, 0.9);
    animation: typing-dot 1.4s ease-in-out infinite both;
}
.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot {
    0%, 80%, 100% { opacity: 0.4; transform: scale(0.85); }
    40% { opacity: 1; transform: scale(1); }
}

.message-content h1 {
    font-size: 1.4em;
    font-weight: 700;
    margin: 1em 0 0.5em 0;
}
.message-content h1:first-child { margin-top: 0; }
.message-content h2 {
    font-size: 1.2em;
    font-weight: 700;
    margin: 0.9em 0 0.4em 0;
}
.message-content h2:first-child { margin-top: 0; }
.message-content h3 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0.8em 0 0.35em 0;
}
.message-content h3:first-child { margin-top: 0; }
.message-content p {
    margin: 0 0 0.75em 0;
}
.message-content p:last-child {
    margin-bottom: 0;
}
.message-content strong {
    font-weight: 700;
}
.message-content em {
    font-style: italic;
}
.message-content a {
    color: var(--color-cyan);
    text-decoration: underline;
}
.chat-balance-warning {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(255, 180, 0, 0.15);
    border: 1px solid rgba(255, 180, 0, 0.4);
    border-radius: 8px;
    color: #e6a800;
    font-size: 13px;
}

.message-content a:hover {
    color: var(--color-pink);
}
.message-content ul {
    margin: 0.5em 0;
    padding-left: 1.25em;
}
.message-content li {
    margin: 0.25em 0;
}

.message.user .message-content {
    border-left: none;
    border-right: 4px solid var(--color-cyan);
}

.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}
.message-attach-img-wrap {
    border-radius: 8px;
    overflow: hidden;
    max-width: 280px;
    cursor: pointer;
    border: 2px solid rgba(139, 92, 246, 0.4);
}
.message-attach-img-wrap:hover {
    border-color: var(--color-purple);
}
.message-attach-img {
    display: block;
    max-width: 100%;
    max-height: 220px;
    object-fit: cover;
    vertical-align: middle;
}
.message-attach-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(31, 41, 55, 0.8);
    border-radius: 6px;
    color: var(--color-cyan);
    text-decoration: none;
    font-size: 13px;
    border: 1px solid rgba(6, 182, 212, 0.4);
}
.message-attach-file:hover {
    background: rgba(31, 41, 55, 1);
    border-color: var(--color-cyan);
}
.message-attach-file-icon {
    font-size: 16px;
}
.message-attach-file-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.message-content .message-text {
    margin-top: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-image-fullscreen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.chat-image-fullscreen img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.chat-image-fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    border-radius: 8px;
}
.chat-image-fullscreen-close:hover {
    background: rgba(255,255,255,0.25);
}

.chat-input-area .chat-attachments-preview {
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 0 12px 0;
    align-items: flex-start;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto 0 auto;
    order: -1;
}
.chat-attach-chip {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(31, 41, 55, 0.8);
    border: 2px solid rgba(139, 92, 246, 0.5);
}
.chat-attach-chip-file {
    width: auto;
    height: auto;
    min-width: 120px;
    padding: 8px 28px 8px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-attach-chip-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.chat-attach-chip-icon {
    font-size: 18px;
}
.chat-attach-chip-name {
    font-size: 11px;
    color: var(--color-gray);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-attach-chip-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
}
.chat-attach-chip-remove:hover {
    background: var(--color-pink);
}

.chat-input-area {
    padding: 20px 30px;
    background: rgba(15, 20, 25, 0.9);
    backdrop-filter: blur(10px);
    border-top: 4px solid var(--color-pink);
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.input-container {
    display: flex;
    gap: 15px;
    align-items: center;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.chat-input {
    flex: 1;
    padding: 15px 20px;
    background: var(--color-dark-input);
    color: var(--color-light);
    border: 3px solid var(--color-purple);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    outline: none;
    resize: none;
    min-height: 56px;
    max-height: 150px;
    transition: all 0.3s ease;
    line-height: 1.5;
    overflow-y: hidden;
}

.chat-input.has-scroll {
    overflow-y: auto;
}

.chat-input::-webkit-scrollbar {
    width: 8px;
}

.chat-input::-webkit-scrollbar-track {
    background: var(--color-dark);
    border-left: 2px solid var(--color-purple);
}

.chat-input::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--color-purple), var(--color-pink));
    border-radius: 0;
}

.chat-input::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--color-cyan), var(--color-blue));
}

.chat-input:focus {
    border-color: var(--color-cyan);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
}

.chat-input::placeholder {
    color: var(--color-gray);
    opacity: 0.6;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

.attach-button {
    padding: 0;
    width: 56px;
    height: 56px;
    background: rgba(139, 92, 246, 0.2);
    color: var(--color-purple);
    border: 3px solid var(--color-purple);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.attach-icon {
    width: 22px;
    height: 22px;
    stroke: var(--color-purple);
    transition: stroke 0.3s ease;
}

.attach-button:hover {
    background: rgba(139, 92, 246, 0.4);
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4);
}

.attach-button:hover .attach-icon {
    stroke: var(--color-cyan);
}

.attach-button:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.send-button {
    padding: 0 28px;
    height: 56px;
    background: linear-gradient(135deg, var(--color-pink), var(--color-purple));
    color: white;
    border: none;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4);
}

.send-button:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.input-options {
    width: 100%;
    max-width: 1200px;
    margin: 15px auto 0;
    padding-top: 15px;
    border-top: 2px solid rgba(139, 92, 246, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.model-selector {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-left: 0;
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
}

.model-selector label {
    font-size: 9px;
    color: var(--color-gray);
    white-space: nowrap;
    flex-shrink: 0;
}

.model-selector select {
    padding: 8px 12px;
    background: var(--color-dark-input);
    color: var(--color-light);
    border: 2px solid var(--color-purple);
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    cursor: pointer;
    outline: none;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

.chat-quick-create {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

.chat-quick-create-btn {
    width: 56px;
    height: 56px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.2);
    color: var(--color-purple);
    border: 3px solid var(--color-purple);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.chat-quick-create-icon {
    stroke: var(--color-purple);
    transition: stroke 0.3s ease;
}

.chat-quick-create-btn:hover {
    background: rgba(139, 92, 246, 0.4);
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4);
}

.chat-quick-create-btn:hover .chat-quick-create-icon {
    stroke: var(--color-cyan);
}

.chat-quick-create-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.chat-quick-create-btn:focus-visible {
    outline: 2px solid var(--color-cyan);
    outline-offset: 3px;
}

.chat-gen-hint {
    width: 100%;
    max-width: 1200px;
    margin: 10px auto 0;
    padding: 10px 12px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 2px solid rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.12);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.25);
}

.chat-gen-hint.is-visible {
    display: flex;
}

.chat-gen-hint__text {
    font-size: 9px;
    color: var(--color-light);
    line-height: 1.6;
}

.chat-gen-hint__links {
    display: inline-flex;
    gap: 10px;
    margin-left: 10px;
}

.chat-gen-hint__link {
    color: var(--color-cyan);
    text-decoration: none;
    border-bottom: 1px dashed rgba(6, 182, 212, 0.6);
}

.chat-gen-hint__link:hover {
    border-bottom-color: rgba(6, 182, 212, 1);
}

.chat-gen-hint__close {
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(0, 0, 0, 0.15);
    color: var(--color-light);
    border: 2px solid rgba(139, 92, 246, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.25);
}

.chat-gen-hint__close:hover {
    border-color: var(--color-cyan);
}

.model-selector select:focus {
    border-color: var(--color-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

@media (max-width: 1024px) {
    .chat-area {
        padding: 20px;
    }
    
    .chat-input-area {
        padding: 15px 20px;
    }
    
    .chat-empty h2 {
        font-size: 20px;
    }
    
    .chat-empty p {
        font-size: 10px;
    }
}

@media (max-width: 768px) {
    .chat-area {
        padding: 15px;
    }
    
    .chat-input-area {
        padding: 15px;
    }

    .input-container {
        gap: 8px;
    }

    .attach-button {
        width: 46px;
        height: 46px;
    }

    .attach-icon {
        width: 18px;
        height: 18px;
    }
    
    .chat-input {
        font-size: 14px;
        min-height: 46px;
        padding: 12px 15px;
    }

    .send-button {
        font-size: 8px;
        height: 46px;
        padding: 0 14px;
    }

    .input-options {
        padding-top: 10px;
        margin-top: 10px;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .model-selector {
        width: auto;
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
        flex-direction: row;
        gap: 8px;
        align-items: center;
        margin-left: 0;
    }

    .chat-quick-create {
        gap: 6px;
        margin-left: 0;
    }

    .chat-quick-create-btn {
        width: 46px;
        height: 46px;
    }

    .chat-quick-create-icon {
        width: 18px;
        height: 18px;
    }

    .chat-gen-hint__text {
        font-size: 8px;
    }
    
    .model-selector label {
        font-size: 8px;
        white-space: nowrap;
    }

    .model-selector select {
        flex: 1;
        min-width: auto;
        font-size: 7px;
        padding: 10px;
    }

    .chat-empty {
        padding: 20px;
    }

    .chat-empty h2 {
        font-size: 16px;
        margin-bottom: 20px;
    }

    .chat-empty p {
        font-size: 9px;
        line-height: 1.8;
    }

    .message {
        gap: 10px;
    }
    
    .message-avatar {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }

    .message-content {
        font-size: 17px;
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .chat-area {
        padding: 10px;
    }
    
    .chat-input-area {
        padding: 10px;
    }

    .input-container {
        gap: 6px;
    }

    .attach-button {
        width: 42px;
        height: 42px;
    }

    .attach-icon {
        width: 16px;
        height: 16px;
    }
    
    .chat-input {
        font-size: 14px;
        min-height: 42px;
        padding: 10px 12px;
    }

    .send-button {
        font-size: 7px;
        height: 42px;
        padding: 0 12px;
    }

    .chat-quick-create-btn {
        width: 42px;
        height: 42px;
    }

    .chat-quick-create-icon {
        width: 16px;
        height: 16px;
    }

    .model-selector label {
        font-size: 7px;
    }

    .model-selector select {
        font-size: 6px;
        padding: 8px;
    }

    .chat-empty h2 {
        font-size: 14px;
    }

    .chat-empty p {
        font-size: 8px;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .message-content {
        font-size: 16px;
        padding: 10px 12px;
    }
}
