* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html, body {
    height: 100%;
    overflow: hidden;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    flex-direction: column;
    color: #fff;
}
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    padding: 15px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    z-index: 3000;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}
.cookie-banner.hidden {
    display: none;
}
.cookie-banner p {
    font-size: 0.9rem;
    color: #ccc;
}
.cookie-banner a {
    color: #00d4ff;
}
.cookie-banner .cookie-close {
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    background: linear-gradient(90deg, #00d4ff, #7b2cbf);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
}
.body-content {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}
.sidebar {
    width: 260px;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s;
}
.sidebar.collapsed {
    transform: translateX(-100%);
}
.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
.new-chat-btn {
    width: 100%;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}
.new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
.new-chat-btn .icon {
    width: 18px;
    height: 18px;
}
.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    min-height: 0;
}
.conversation-item {
    padding: 12px 15px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 5px;
    transition: background 0.2s;
    font-size: 0.9rem;
    position: relative;
}
.conversation-item:hover {
    background: rgba(255, 255, 255, 0.1);
}
.conversation-item.active {
    background: rgba(0, 212, 255, 0.2);
}
.conversation-item .conv-title {
    color: #fff;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 30px;
}
.conversation-item .conv-time {
    font-size: 0.75rem;
    color: #888;
}
.conversation-item .delete-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 71, 87, 0.2);
    color: #ff4757;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.conversation-item:hover .delete-btn {
    display: flex;
}
.conversation-item .delete-btn:hover {
    background: rgba(255, 71, 87, 0.4);
}
.conversation-item .delete-btn svg {
    width: 14px;
    height: 14px;
}
.sidebar-toggle {
    position: fixed;
    left: 10px;
    top: 10px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}
.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}
.main-content {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}
.header {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}
.header h1 {
    font-size: 1.3rem;
    background: linear-gradient(90deg, #00d4ff, #7b2cbf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 8px;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lang-switch {
    display: flex;
    align-items: center;
}
.lang-select {
    padding: 6px 12px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}
.lang-select option {
    background: #1a1a2e;
    color: #fff;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-name {
    color: #00d4ff;
    font-size: 0.9rem;
}
.auth-btns {
    display: flex;
    gap: 8px;
}
.auth-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.auth-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
.auth-btn.primary {
    background: linear-gradient(90deg, #00d4ff, #7b2cbf);
    border: none;
}
.auth-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 15px rgba(0, 212, 255, 0.3);
}
.model-select {
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}
.model-select option {
    background: #1a1a2e;
    color: #fff;
}
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    min-height: 0;
}
.message {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
    position: relative;
    padding-top: 30px;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.message-user {
    text-align: right;
}
.message-user .bubble {
    background: linear-gradient(135deg, #00d4ff, #7b2cbf);
    color: #fff;
}
.message-ai .bubble {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.bubble {
    display: inline-block;
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 18px;
    text-align: left;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
}
.message-label {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 5px;
}
.message-actions {
    position: absolute;
    top: 0;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    gap: 5px;
    z-index: 10;
}
.message-user .message-actions {
    left: 0;
}
.message-ai .message-actions {
    right: 0;
}
.message:hover .message-actions {
    opacity: 1;
}
.action-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.action-btn svg {
    width: 14px;
    height: 14px;
}
.think-block {
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid #7b2cbf;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}
.think-header {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #888;
    transition: background 0.2s;
}
.think-header:hover {
    background: rgba(255, 255, 255, 0.05);
}
.think-header svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}
.think-block.expanded .think-header svg {
    transform: rotate(90deg);
}
.think-content {
    padding: 0 15px 15px;
    font-size: 0.85rem;
    color: #aaa;
    white-space: pre-wrap;
    line-height: 1.5;
    display: none;
}
.think-block.expanded .think-content {
    display: block;
}
.input-area {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
.input-wrapper {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.input-wrapper textarea {
    flex: 1;
    padding: 12px 18px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
    resize: none;
    outline: none;
    max-height: 120px;
    font-family: inherit;
}
.input-wrapper textarea:focus {
    border-color: #00d4ff;
}
.input-wrapper textarea::placeholder {
    color: #888;
}
.send-btn {
    padding: 12px 25px;
    border-radius: 25px;
    border: none;
    background: linear-gradient(90deg, #00d4ff, #7b2cbf);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    white-space: nowrap;
}
.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.3);
}
.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.status-bar {
    text-align: center;
    padding: 8px;
    font-size: 0.85rem;
    color: #888;
    flex-shrink: 0;
}
.status-bar.error {
    color: #ff4757;
}
.status-bar.waiting {
    color: #ffa502;
}
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 12px 18px;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #888;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}
.welcome {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}
.welcome h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #fff;
}
.welcome p {
    font-size: 0.95rem;
}
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal {
    background: #1a1a2e;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s;
}
.modal-overlay.active .modal {
    transform: scale(1);
}
.modal h2 {
    text-align: center;
    margin-bottom: 25px;
    background: linear-gradient(90deg, #00d4ff, #7b2cbf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.modal-input {
    padding: 12px 18px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
    outline: none;
}
.modal-input:focus {
    border-color: #00d4ff;
}
.modal-input::placeholder {
    color: #888;
}
.modal-btn {
    padding: 12px 25px;
    border-radius: 25px;
    border: none;
    background: linear-gradient(90deg, #00d4ff, #7b2cbf);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}
.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.3);
}
.modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.modal-footer {
    text-align: center;
    margin-top: 20px;
    color: #888;
    font-size: 0.85rem;
}
.modal-footer a {
    color: #00d4ff;
    cursor: pointer;
}
.modal-error {
    color: #ff4757;
    font-size: 0.85rem;
    text-align: center;
    min-height: 20px;
}
.cf-turnstile {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}
.icon {
    width: 1em;
    height: 1em;
    vertical-align: middle;
}
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    z-index: 2000;
    animation: toastIn 0.3s ease;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 200;
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .sidebar-toggle {
        display: flex;
    }
    .header {
        padding: 12px 15px;
        padding-left: 60px;
    }
    .header h1 {
        font-size: 1.1rem;
    }
    .header h1 span {
        display: none;
    }
    .header-left {
        gap: 10px;
    }
    .model-select {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    .chat-container {
        padding: 15px;
    }
    .bubble {
        max-width: 90%;
        padding: 10px 15px;
        font-size: 0.95rem;
    }
    .input-area {
        padding: 12px 15px;
    }
    .input-wrapper textarea {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
    .send-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    .welcome {
        padding: 40px 15px;
    }
    .welcome h2 {
        font-size: 1.2rem;
    }
    .welcome p {
        font-size: 0.85rem;
    }
    .message-actions {
        opacity: 1;
    }
    .action-btn {
        width: 26px;
        height: 26px;
    }
    .cookie-banner {
        padding: 12px 15px;
        gap: 10px;
    }
    .cookie-banner p {
        font-size: 0.8rem;
    }
    .cookie-banner .cookie-close {
        padding: 6px 15px;
        font-size: 0.8rem;
    }
    .toast {
        bottom: 80px;
        font-size: 0.85rem;
        padding: 8px 16px;
    }
    .lang-select {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    .auth-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    .user-name {
        display: none;
    }
}

@media (max-width: 480px) {
    .header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    .bubble {
        max-width: 95%;
        font-size: 0.9rem;
    }
    .modal {
        padding: 20px;
        margin: 10px;
    }
    .modal-input {
        padding: 10px 15px;
    }
    .modal-btn {
        padding: 10px 20px;
    }
}
