:root {
  --bg: #0b1220;
  --panel: #101a2e;
  --panel-2: #16233c;
  --line: #22304a;
  --text: #e8eef7;
  --muted: #93a9c4;
  --accent: #38d996;
  --accent-2: #4ea1ff;
  --danger: #ff7b72;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 600px at 80% -10%, #14304a 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* 顶栏 */
.topbar { border-bottom: 1px solid var(--line); background: rgba(11, 18, 32, .8); backdrop-filter: blur(6px); }
.topbar-inner { max-width: 960px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 700; letter-spacing: .5px; }
.brand-icon { margin-right: 6px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.whoami { color: var(--muted); font-size: 13px; }
.btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 12px; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

/* 登录 */
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px 28px; box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.login-logo { font-size: 44px; text-align: center; }
.login-title { font-size: 22px; text-align: center; margin: 10px 0 4px; }
.login-sub { color: var(--muted); font-size: 13px; text-align: center; margin: 0 0 22px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none;
}
.field input:focus { border-color: var(--accent-2); }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; }
.captcha-box { cursor: pointer; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; height: 42px; display: flex; align-items: center; background: #fff; }
.captcha-box svg { display: block; height: 40px; }
.form-error { color: var(--danger); font-size: 13px; margin: 0 0 10px; }
.btn-primary {
  width: 100%; border: 0; border-radius: 10px; padding: 11px 0; font-size: 15px; cursor: pointer;
  color: #06281c; font-weight: 700; background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

/* 对话 */
.chat-wrap { flex: 1; display: flex; flex-direction: column; max-width: 960px; width: 100%; margin: 0 auto; min-height: 0; padding: 16px; gap: 12px; }
.msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, #1d4d3a, #173a52); border: 1px solid #2a5c48; }
.msg.ai { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.msg.sys { align-self: center; background: transparent; border: 0; color: var(--muted); font-size: 12.5px; max-width: 90%; text-align: center; }
.msg.ai.streaming::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.composer { display: flex; gap: 10px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.composer textarea {
  flex: 1; resize: none; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 14.5px; line-height: 1.5; outline: none; font-family: inherit;
}
.composer textarea:focus { border-color: var(--accent-2); }
.composer .btn-primary { width: 84px; padding: 10px 0; }

/* 页脚 */
.footer { border-top: 1px solid var(--line); padding: 14px 16px 18px; text-align: center; }
.footer p { margin: 3px 0; font-size: 12.5px; color: var(--muted); }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--text); }

@media (max-width: 640px) {
  .msg { max-width: 92%; }
}
