:root {
  --bg: #0c0d10;
  --bg-soft: #14161b;
  --panel: #171a21;
  --panel-2: #1d212a;
  --border: #262b36;
  --text: #e8eaf0;
  --text-dim: #9aa2b1;
  --gold: #f0b429;
  --gold-soft: #ffd66b;
  --accent: #3b82f6;
  --user-bubble: #1f6feb;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 800px at 80% -10%, #1a1d27 0%, var(--bg) 55%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ───────────────────────────────── */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-soft) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--gold) 0%, #c8901a 100%);
  color: #1a1300; font-weight: 800; font-size: 22px;
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(240, 180, 41, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-weight: 800; font-size: 17px; letter-spacing: 0.3px; }
.brand-sub { font-size: 12px; color: var(--gold-soft); font-weight: 600; }

.modes { display: flex; flex-direction: column; gap: 6px; }
.mode {
  display: flex; align-items: center; gap: 12px;
  background: transparent; border: 1px solid transparent;
  color: var(--text-dim); cursor: pointer;
  padding: 11px 12px; border-radius: 11px;
  text-align: left; transition: all 0.15s ease; font-family: inherit;
}
.mode:hover { background: var(--panel-2); color: var(--text); }
.mode.active {
  background: var(--panel-2);
  border-color: rgba(240, 180, 41, 0.4);
  color: var(--text);
}
.mode.active .mode-ico { filter: drop-shadow(0 0 8px rgba(240,180,41,0.5)); }
.mode-ico { font-size: 20px; flex-shrink: 0; }
.mode-label { display: flex; flex-direction: column; font-weight: 600; font-size: 14px; }
.mode-label small { font-weight: 400; font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.new-chat {
  margin-top: auto;
  background: linear-gradient(135deg, var(--gold) 0%, #d99c1c 100%);
  color: #1a1300; border: none; font-weight: 700; font-size: 14px;
  padding: 12px; border-radius: 11px; cursor: pointer;
  font-family: inherit; transition: transform 0.1s ease, filter 0.15s;
}
.new-chat:hover { filter: brightness(1.08); }
.new-chat:active { transform: scale(0.98); }

.sidebar-footer {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-dim);
  padding-top: 6px; border-top: 1px solid var(--border);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2ec16e; box-shadow: 0 0 8px #2ec16e; }
.dot.bad { background: #e5484d; box-shadow: 0 0 8px #e5484d; }

/* ── Main ──────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 13, 16, 0.6);
  backdrop-filter: blur(8px);
}
.topbar h1 { font-size: 18px; font-weight: 700; }
.topbar p { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

.chat {
  flex: 1; overflow-y: auto;
  padding: 28px 0;
  scroll-behavior: smooth;
}
.chat::-webkit-scrollbar { width: 10px; }
.chat::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

/* Welcome */
.welcome {
  max-width: 760px; margin: 40px auto; padding: 0 28px;
  text-align: center;
}
.welcome-logo {
  width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 18px;
  background: linear-gradient(135deg, var(--gold) 0%, #c8901a 100%);
  color: #1a1300; font-weight: 800; font-size: 32px;
  display: grid; place-items: center;
  box-shadow: 0 8px 28px rgba(240, 180, 41, 0.4);
}
.welcome h2 { font-size: 24px; font-weight: 800; margin-bottom: 10px; }
.welcome p { color: var(--text-dim); font-size: 15px; max-width: 520px; margin: 0 auto 28px; }
.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .suggestions { grid-template-columns: 1fr; } }
.suggestion {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; cursor: pointer;
  text-align: left; color: var(--text); font-family: inherit; font-size: 14px;
  transition: all 0.15s ease;
}
.suggestion:hover { border-color: rgba(240,180,41,0.5); background: var(--panel-2); transform: translateY(-2px); }
.suggestion b { display: block; margin-bottom: 4px; }
.suggestion span { color: var(--text-dim); font-size: 12.5px; }

/* Messages */
.msg { max-width: 820px; margin: 0 auto 22px; padding: 0 28px; display: flex; gap: 14px; }
.msg .avatar {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.msg.user .avatar { background: var(--user-bubble); color: #fff; }
.msg.assistant .avatar {
  background: linear-gradient(135deg, var(--gold) 0%, #c8901a 100%); color: #1a1300;
}
.bubble {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  font-size: 15px; line-height: 1.65; overflow-wrap: anywhere;
}
.msg.user .bubble { background: var(--panel-2); border-color: #2f3848; }

.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 8px 0 12px; padding-left: 22px; }
.bubble li { margin-bottom: 5px; }
.bubble h1, .bubble h2, .bubble h3 { margin: 14px 0 8px; font-weight: 700; }
.bubble h1 { font-size: 19px; } .bubble h2 { font-size: 17px; } .bubble h3 { font-size: 15.5px; }
.bubble code {
  background: #0c0e13; border: 1px solid var(--border); border-radius: 6px;
  padding: 1px 6px; font-size: 13px; font-family: "Consolas", monospace; color: var(--gold-soft);
}
.bubble pre {
  background: #0c0e13; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; overflow-x: auto; margin: 10px 0;
}
.bubble pre code { background: none; border: none; padding: 0; color: var(--text); }
.bubble strong { color: var(--gold-soft); }
.bubble a { color: var(--accent); }
.bubble hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

.thinking { color: var(--text-dim); }
.thinking b { color: var(--gold-soft); }
.thinking small { font-size: 12px; opacity: 0.8; }

.cursor {
  display: inline-block; width: 8px; height: 16px; background: var(--gold);
  margin-left: 2px; border-radius: 1px; animation: blink 1s steps(2) infinite;
  vertical-align: text-bottom;
}
@keyframes blink { 0%,50%{opacity:1} 50.01%,100%{opacity:0} }

/* ── Composer ──────────────────────────────── */
.composer { padding: 14px 28px 20px; border-top: 1px solid var(--border); background: rgba(12,13,16,0.7); }
.composer-inner {
  max-width: 820px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 8px 8px 8px 18px; transition: border-color 0.15s;
}
.composer-inner:focus-within { border-color: rgba(240,180,41,0.5); }
#input {
  flex: 1; background: none; border: none; outline: none; resize: none;
  color: var(--text); font-family: inherit; font-size: 15px; line-height: 1.5;
  max-height: 200px; padding: 8px 0;
}
#input::placeholder { color: var(--text-dim); }
.send-btn {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 11px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--gold) 0%, #d99c1c 100%); color: #1a1300;
  font-size: 16px; transition: transform 0.1s, filter 0.15s, opacity 0.15s;
}
.send-btn:hover { filter: brightness(1.1); }
.send-btn:active { transform: scale(0.94); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.composer-hint { max-width: 820px; margin: 8px auto 0; text-align: center; font-size: 11.5px; color: var(--text-dim); }

@media (max-width: 760px) {
  .sidebar { position: fixed; z-index: 20; height: 100%; transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: none; }
}
