:root{
  --bg:#0b0c10;
  --panel:#12141a;
  --text:#e8eaf0;
  --muted:#9aa3b2;
  --accent:#6ee7ff;
  --bubbleUser:#1f2a44;
  --bubbleAI:#19232a;
  --border: rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --input:#0f1117;
}
:root[data-theme="light"]{
  --bg:#f6f7fb;
  --panel:#ffffff;
  --text:#101223;
  --muted:#5b6472;
  --accent:#0077ff;
  --bubbleUser:#e7efff;
  --bubbleAI:#f0f3f8;
  --border: rgba(0,0,0,.08);
  --shadow: 0 10px 30px rgba(0,0,0,.10);
  --input:#ffffff;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: var(--bg);
  color: var(--text);
}

.app{
  max-width: 980px;
  margin: 0 auto;
  min-height: 100vh;
  display:flex;
  flex-direction:column;
  padding: 16px;
  gap: 12px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.brand{display:flex; gap:12px; align-items:center;}
.dot{
  width:12px;height:12px;border-radius:999px;background: var(--accent);
  box-shadow: 0 0 18px rgba(110,231,255,.55);
}
.title{font-weight:700; letter-spacing:.2px}
.subtitle{font-size:12px; color: var(--muted); margin-top:2px}

.actions{display:flex; gap:8px}

.btn{
  border: 1px solid var(--border);
  background: var(--accent);
  color: #061018;
  padding: 10px 14px;
  border-radius: 14px;
  cursor:pointer;
  font-weight:700;
  transition: transform .06s ease, filter .12s ease;
}
.btn:hover{filter: brightness(1.03)}
.btn:active{transform: translateY(1px)}
.btn.ghost{
  background: transparent;
  color: var(--text);
  font-weight:700;
}

.chat{
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  overflow:auto;
  box-shadow: var(--shadow);
}

.hint{
  color: var(--muted);
  font-size: 13px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  margin-bottom: 12px;
}

.row{
  display:flex;
  margin: 10px 0;
}
.row.user{justify-content:flex-end}
.row.assistant{justify-content:flex-start}

.bubble{
  max-width: min(680px, 92%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 12px;
  white-space: pre-wrap;
  line-height: 1.38;
}
.row.user .bubble{
  background: var(--bubbleUser);
}
.row.assistant .bubble{
  background: var(--bubbleAI);
}

.meta{
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}
.meta a{color: var(--accent); text-decoration:none}
.meta a:hover{text-decoration:underline}

.composer{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px;
  box-shadow: var(--shadow);
}

#chatForm{
  display:flex;
  gap: 10px;
}
#message{
  flex:1;
  border: 1px solid var(--border);
  background: var(--input);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 12px;
  outline:none;
}
#message::placeholder{color: var(--muted)}

.typing{
  display:inline-flex;
  gap: 6px;
  align-items:center;
}
.typing .dot{
  width: 6px;height:6px;border-radius:999px;background: var(--muted);
  box-shadow:none;
  opacity:.65;
  animation: bounce 1s infinite ease-in-out;
}
.typing .dot:nth-child(2){animation-delay:.15s}
.typing .dot:nth-child(3){animation-delay:.3s}

@keyframes bounce{
  0%, 80%, 100%{transform: translateY(0)}
  40%{transform: translateY(-4px)}
}
