﻿:root {
  --bg: #212121;
  --panel: #171717;
  --panel-2: #2f2f2f;
  --text: #ececec;
  --muted: #a7a7a7;
  --line: #3b3b3b;
  --accent: #ffffff;
  --danger: #ff6b6b;
  --bubble-user: #303030;
  --bubble-ai: transparent;
  --shadow: 0 18px 45px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, textarea { font: inherit; }
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 270px; flex: 0 0 270px;
  background: var(--panel);
  border-right: 1px solid rgba(255,255,255,.05);
  padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.new-chat {
  width: 100%; height: 42px; border: 1px solid var(--line);
  background: transparent; color: var(--text); border-radius: 12px;
  text-align: left; padding: 0 14px; cursor: pointer;
}
.new-chat:hover, .history-item:hover { background: #242424; }
.history-title { color: var(--muted); font-size: 12px; padding: 6px 8px 0; }
.history { flex: 1; overflow: auto; }
.history-item {
  width: 100%; border: 0; border-radius: 10px; background: transparent;
  color: #d6d6d6; text-align: left; padding: 10px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-footer { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #f1f1f1; color: #111; display: grid; place-items: center; font-weight: 700; }
.name { font-size: 14px; }
.muted { color: var(--muted); font-size: 12px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar { height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 18px; }
.icon-btn { display: none; border: 0; background: transparent; color: var(--text); font-size: 20px; cursor: pointer; }
.site-name { font-weight: 650; }
.quota { color: var(--muted); font-size: 12px; margin-top: 2px; }
.messages { flex: 1; overflow-y: auto; padding: 28px 18px 150px; scroll-behavior: smooth; }
.welcome { max-width: 760px; margin: 9vh auto 0; text-align: center; }
.logo { margin: 0 auto 18px; width: 52px; height: 52px; border-radius: 17px; display: grid; place-items: center; background: #f4f4f4; color: #111; font-size: 28px; box-shadow: var(--shadow); }
h1 { font-size: clamp(28px, 5vw, 42px); margin: 0 0 10px; letter-spacing: -.03em; }
p { color: var(--muted); margin: 0; }
.examples { margin-top: 28px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.examples button {
  min-height: 54px; border: 1px solid var(--line); background: #262626;
  color: var(--text); border-radius: 14px; cursor: pointer; padding: 10px;
}
.examples button:hover { background: #303030; }
.msg { max-width: 790px; margin: 0 auto 22px; display: flex; gap: 16px; align-items: flex-start; }
.msg .role { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 32px; font-weight: 700; }
.msg.user { justify-content: flex-end; }
.msg.user .role { display: none; }
.msg.user .content { background: var(--bubble-user); border-radius: 20px; padding: 12px 16px; max-width: min(680px, 86%); }
.msg.ai .role { background: #f1f1f1; color: #111; }
.content { line-height: 1.72; white-space: pre-wrap; overflow-wrap: anywhere; }
.content.loading { color: var(--muted); }
.content.error { color: var(--danger); }
.composer-wrap { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 18px 14px; background: linear-gradient(180deg, rgba(33,33,33,0), var(--bg) 28%); }
.composer { max-width: 790px; margin: 0 auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: 26px; padding: 10px 10px 10px 18px; display: flex; align-items: flex-end; gap: 10px; box-shadow: var(--shadow); }
textarea { flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); min-height: 28px; max-height: 180px; line-height: 1.55; padding: 4px 0; }
textarea::placeholder { color: #b8b8b8; }
#sendBtn { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--accent); color: #111; font-weight: 800; cursor: pointer; }
#sendBtn:disabled { opacity: .35; cursor: not-allowed; }
.hint { max-width: 790px; margin: 8px auto 0; text-align: center; color: var(--muted); font-size: 12px; }
@media (max-width: 800px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-102%); transition: .2s ease; z-index: 10; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .icon-btn { display: block; }
  .examples { grid-template-columns: 1fr; }
  .messages { padding-top: 12px; }
}
