:root {
    --tea-50: #f6f1e7;
    --tea-100: #e8dcc4;
    --tea-300: #c9a87a;
    --tea-500: #a87c4f;
    --tea-600: #8b5e34;
    --tea-700: #6b4423;
    --tea-900: #3d2614;
    --bg: #faf6ef;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
    background: var(--bg);
    color: var(--tea-900);
    height: 100vh;
    overflow: hidden;
}
a { color: var(--tea-600); text-decoration: none; }

/* 认证页 */
.auth-body {
    background: linear-gradient(135deg, var(--tea-600) 0%, var(--tea-700) 100%);
    display: flex; align-items: center; justify-content: center;
}
.auth-card {
    background: #fff; padding: 40px 32px; border-radius: 16px;
    width: 92%; max-width: 380px;
    box-shadow: 0 20px 60px rgba(107,68,35,0.3);
}
.auth-card h1 { font-size: 24px; margin-bottom: 8px; color: var(--tea-700); }
.auth-card .subtitle { color: #888; margin-bottom: 24px; font-size: 14px; }
.auth-card input {
    width: 100%; padding: 12px 14px; margin-bottom: 12px;
    border: 1px solid var(--tea-100); border-radius: 10px; font-size: 15px;
}
.auth-card input:focus { outline: none; border-color: var(--tea-500); }
.auth-card button {
    width: 100%; padding: 13px; background: var(--tea-600); color: #fff;
    border: none; border-radius: 10px; font-size: 16px; font-weight: 500; cursor: pointer;
}
.auth-card button:hover { background: var(--tea-700); }
.auth-card .switch { text-align: center; margin-top: 18px; font-size: 14px; color: #888; }
.alert { background: #fde7e7; color: #b33; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.alert.success { background: #e7f3ec; color: var(--tea-700); }

/* 顶栏 */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--tea-100);
    gap: 12px;
}
.brand { display: flex; align-items: center; min-width: 0; flex: 1; }
.brand img {
    height: 38px; width: auto; max-width: 220px; object-fit: contain;
}
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.model-badge {
    background: var(--tea-50); color: var(--tea-700);
    padding: 5px 11px; border-radius: 14px; font-size: 12px; font-weight: 500;
    border: 1px solid var(--tea-100);
}
.settings-link, .topbar .back { font-size: 14px; color: var(--tea-600); }

/* 认证页 logo */
.auth-card { text-align: center; }
.auth-logo {
    display: flex; justify-content: center; margin-bottom: 18px;
}
.auth-logo img {
    width: 96px; height: 96px; object-fit: contain; border-radius: 20px;
}
.auth-card h1 { text-align: center; }

/* 设置页 */
.settings-page { display: flex; flex-direction: column; height: 100vh; }
.settings-page main { padding: 24px 20px; flex: 1; overflow-y: auto; }
.info-box {
    background: var(--tea-50); border: 1px solid var(--tea-100);
    border-radius: 12px; padding: 14px 16px; margin-bottom: 20px; font-size: 14px;
}
.info-box strong { color: var(--tea-700); }
.info-box .hint { color: #888; font-size: 13px; margin-top: 6px; }
.settings-form label { display: block; margin-bottom: 18px; font-size: 14px; color: var(--tea-700); }
.settings-form input {
    width: 100%; padding: 11px 13px; margin-top: 6px;
    border: 1px solid var(--tea-100); border-radius: 10px; font-size: 15px;
}
.settings-form input:focus { outline: none; border-color: var(--tea-500); }
.settings-form button {
    background: var(--tea-600); color: #fff; border: none;
    padding: 12px 28px; border-radius: 10px; font-size: 15px; cursor: pointer;
}
.settings-form button:hover { background: var(--tea-700); }

/* 聊天主页 */
.app { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }
.chat { flex: 1; overflow-y: auto; padding: 20px 16px; scroll-behavior: smooth; }
.welcome { text-align: center; color: var(--tea-700); margin-top: 80px; }
.welcome-logo {
    width: 90px; height: 90px; margin: 0 auto 20px;
    border-radius: 18px; object-fit: contain;
    box-shadow: 0 4px 16px rgba(107,68,35,0.12);
}
.welcome h1 { font-size: 20px; font-weight: 500; color: var(--tea-700); }

.msg { display: flex; gap: 12px; margin-bottom: 18px; align-items: flex-start; }
.msg .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.msg.user .avatar { background: var(--tea-600); color: #fff; }
.msg.ai .avatar { background: var(--tea-700); color: #fff; }

.bubble {
    background: #fff; padding: 11px 15px; border-radius: 14px;
    max-width: 78%; line-height: 1.65; font-size: 15px;
    box-shadow: 0 1px 2px rgba(107,68,35,0.06); word-wrap: break-word;
}
.msg.user .bubble { background: var(--tea-600); color: #fff; }
.bubble pre {
    background: var(--tea-900); color: #f0e6d2; padding: 12px;
    border-radius: 8px; overflow-x: auto; margin: 8px 0; font-size: 13px;
}
.bubble code { font-family: "SF Mono", Consolas, monospace; }

.dot {
    display: inline-block; width: 6px; height: 6px; background: var(--tea-300);
    border-radius: 50%; margin: 0 2px; animation: bounce 1.4s infinite ease-in-out;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* 输入区 */
.composer {
    display: flex; gap: 10px; padding: 12px 16px 16px;
    background: #fff; border-top: 1px solid var(--tea-100); align-items: flex-end;
}
.composer textarea {
    flex: 1; resize: none; border: 1px solid var(--tea-100);
    border-radius: 14px; padding: 11px 14px; font-size: 15px;
    font-family: inherit; line-height: 1.5; max-height: 160px;
}
.composer textarea:focus { outline: none; border-color: var(--tea-500); }
.composer button {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--tea-600); color: #fff; border: none;
    font-size: 14px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.composer button:disabled { background: #ccc; cursor: not-allowed; }

@media (max-width: 600px) {
    .auth-card { width: 90%; padding: 32px 24px; }
    .msg .avatar { width: 30px; height: 30px; font-size: 13px; }
    .bubble { font-size: 14px; }
}