* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #222222;
    --surface: #2a2a2a;
    --surface-hover: #333333;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border: #3a3a3a;
    --border-focused: #5a5a5a;
    --accent-blue: #4a9eff;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    position: fixed;
    width: 100%;
    -webkit-font-smoothing: antialiased;
    -webkit-user-select: text;
    user-select: text;
}

.simple-logo {
    position: fixed;
    top: 16px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
}

.logo-image {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.logo-text {
    font-weight: 500;
    font-size: 20px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.right-buttons {
    position: fixed;
    top: 16px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
}

.new-chat-icon {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.new-chat-icon:hover {
    background: var(--surface-hover);
}

.new-chat-icon svg {
    width: 22px;
    height: 22px;
}

.login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #000000;
    border: 1px solid var(--border);
    border-radius: 30px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    height: 40px;
}

.login-btn:hover {
    background: #222222;
}

.login-btn svg {
    width: 18px;
    height: 18px;
}

.burger-menu {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.burger-menu span {
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.burger-menu:hover span {
    background: var(--border-focused);
}

.burger-menu.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger-menu.open span:nth-child(2) {
    opacity: 0;
}

.burger-menu.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.menu-panel {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100vh;
    background: #0a0a0a;
    border-left: 1px solid var(--border);
    z-index: 1000;
    transition: right 0.3s ease-in-out;
    padding: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

.menu-panel.open {
    right: 0;
}

.menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0 20px;
    margin-bottom: 8px;
}

.menu-title {
    font-weight: 600;
    font-size: 20px;
    color: var(--text-primary);
}

.close-menu {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-menu:hover {
    background: var(--surface-hover);
}

.menu-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
}

.menu-item-gpt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 28px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s ease;
    cursor: pointer;
    font-size: 15px;
    font-weight: 400;
    margin-bottom: 2px;
}

.menu-item-gpt:hover {
    background: var(--surface-hover);
}

.menu-item-gpt svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

.menu-item-gpt span {
    flex: 1;
}

.menu-divider-light {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
    width: 100%;
}

.menu-section-title {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 12px 16px 4px 16px;
    letter-spacing: 0.5px;
}

.chat-history-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.chat-history-list::-webkit-scrollbar {
    display: none;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: 23px;
    margin-bottom: 2px;
}

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

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

.history-title {
    flex: 1;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    padding-right: 8px;
}

.delete-chat {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.delete-chat:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
    opacity: 1;
}

.delete-chat svg {
    width: 18px;
    height: 18px;
}

.history-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.menu-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: #0a0a0a;
    margin-top: auto;
    flex-shrink: 0;
}

.user-profile-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.user-avatar-menu {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name-menu {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-email-menu {
    font-size: 12px;
    color: var(--text-secondary);
}

.profile-logout {
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.profile-logout:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.login-menu-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 28px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.login-menu-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-focused);
}

.login-menu-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.container {
    height: 100vh;
    padding-top: 70px;
    padding-bottom: 100px;
    position: relative;
}

.center-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    padding: 0 20px;
    transition: opacity 0.3s ease;
}

.welcome-title {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.chat-area {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
}

.chat-area::-webkit-scrollbar {
  width: 6px;
}

.chat-area::-webkit-scrollbar-track {
  background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.messages {
    max-width: 800px;
    margin: 0 auto;
}

.message {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    animation: fadeIn 0.3s ease;
}

.message.user {
    justify-content: flex-end;
}

.message.user .message-content {
    background: var(--surface);
    padding: 12px 18px;
    border-radius: 20px 20px 4px 20px;
    max-width: 80%;
}

.message.assistant .message-content {
    background: var(--surface-hover);
    padding: 12px 18px;
    border-radius: 20px 20px 20px 4px;
    max-width: 80%;
}

.message-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    word-break: break-word;
}

.message-text pre {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-text code {
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: monospace;
}

.input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, var(--bg-primary) 90%, transparent);
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 100px;
    padding: 8px 8px 8px 24px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.input-wrapper:focus-within {
    border-color: var(--border-focused);
    background: var(--surface-hover);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: 'SF Pro Display', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    max-height: 120px;
    resize: none;
    padding: 12px 0;
}

.input-wrapper textarea::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
    opacity: 0.7;
}

.send-btn {
    background: var(--accent-blue);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    opacity: 0.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.send-btn.active {
    opacity: 1;
}

.send-btn:hover {
    background: #3a7bc8;
    transform: scale(1.05);
}

.send-btn svg {
    width: 22px;
    height: 22px;
    stroke: white;
    stroke-width: 3;
}

.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background: var(--surface-hover);
    border-radius: 20px;
    width: fit-content;
    margin-left: 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

body.light-theme {
    --bg-primary: #f5f5f5;
    --bg-secondary: #e8e8e8;
    --surface: #ffffff;
    --surface-hover: #e0e0e0;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border: #cccccc;
    --border-focused: #999999;
    --accent-blue: #4a9eff;
}

body.light-theme .menu-panel {
    background: #f0f0f0;
    border-left: 1px solid #dddddd;
    box-shadow: none;
}

body.light-theme .menu-item-gpt {
    color: #1a1a1a;
}

body.light-theme .menu-item-gpt:hover {
    background: #e0e0e0;
}

body.light-theme .menu-item-gpt svg {
    stroke: #1a1a1a;
    fill: #1a1a1a;
}

body.light-theme .history-title {
    color: #1a1a1a;
}

body.light-theme .history-item:hover {
    background: #e0e0e0;
}

body.light-theme .menu-section-title {
    color: #666666;
}

body.light-theme .delete-chat svg {
    stroke: #666666;
}

body.light-theme .delete-chat:hover svg {
    stroke: #dc3545;
}

body.light-theme .login-btn {
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid #cccccc;
}

body.light-theme .login-btn:hover {
    background: #f0f0f0;
}

body.light-theme .new-chat-icon {
    color: #1a1a1a;
}

body.light-theme .new-chat-icon:hover {
    background: #e0e0e0;
}

body.light-theme .burger-menu span {
    background: #1a1a1a;
}

body.light-theme .send-btn {
    background: var(--accent-blue);
}

body.light-theme .send-btn svg {
    stroke: white;
}

body.light-theme .user-name-menu,
body.light-theme .user-email-menu,
body.light-theme .profile-logout {
    color: #1a1a1a;
}

body.light-theme .menu-footer {
    background: #f0f0f0;
    border-top: 1px solid #dddddd;
}

body.light-theme .menu-divider-light {
    background: #dddddd;
}

body.light-theme .login-menu-btn {
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid #dddddd;
}

body.light-theme .login-menu-btn:hover {
    background: #e0e0e0;
    border-color: #999999;
}

body.light-theme .menu-overlay {
    background: transparent;
}

@media (max-width: 600px) {
    .simple-logo {
        top: 12px;
        left: 16px;
    }

    .logo-image {
        width: 32px;
        height: 32px;
    }

    .logo-text {
        font-size: 20px;
    }

    .right-buttons {
        top: 12px;
        right: 16px;
        gap: 8px;
    }

    .new-chat-icon svg {
        width: 20px;
        height: 20px;
    }

    .burger-menu {
        width: 36px;
        height: 36px;
    }

    .menu-panel {
        width: 280px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .message {
        padding: 12px 0;
    }

    .message-text {
        font-size: 15px;
    }

    .input-container {
        padding: 12px;
    }

    .menu-footer {
        padding: 12px 16px;
    }
}

#themeMenuLink {
    padding-left: 22px;
}

.login-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 1001;
    width: 300px;
    text-align: center;
}

.login-modal h2 {
    margin-bottom: 16px;
    font-size: 20px;
    font-weight: 600;
}

.login-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.login-option:hover {
    background: var(--surface-hover);
}

.login-option img {
    width: 24px;
    height: 24px;
}

.message.user .message-text {
    white-space: pre-wrap;
    font-family: inherit;
}