:root {
  --bg: #0a0e14;
  --panel: #111824;
  --panel2: #0d141e;
  --line: #1d2735;
  --text: #e6f1ff;
  --muted: #7d8da3;
  --accent: #38e1ff;
  --accent-dim: #1b6b7d;
  --user: #163a4a;
  --bot: #141c28;
  --err: #ff6b6b;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #0e1722 0%, var(--bg) 60%);
  color: var(--text);
  font-family: -apple-system, "SF Pro Text", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  display: flex; flex-direction: column;
}

/* ---- Login ---- */
.login-body { align-items: center; justify-content: center; }
.login-card {
  margin: auto; width: min(360px, 92vw);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 36px 28px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-card h1 { letter-spacing: 6px; margin: 14px 0 4px; font-weight: 700; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.login-card input, .login-card button {
  width: 100%; padding: 13px 14px; border-radius: 11px; font-size: 15px; border: 1px solid var(--line);
}
.login-card input { background: var(--panel2); color: var(--text); margin-bottom: 12px; }
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button {
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  color: #04222b; font-weight: 700; border: none; cursor: pointer;
}
.login-card .err { color: var(--err); font-size: 13px; display: none; margin: 12px 0 0; }

/* ---- Orb ---- */
.orb {
  width: 56px; height: 56px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #bff7ff, var(--accent) 45%, #0a4452 80%);
  box-shadow: 0 0 30px rgba(56,225,255,.6), inset 0 0 14px rgba(255,255,255,.4);
  animation: pulse 3s ease-in-out infinite;
}
.orb.small { width: 18px; height: 18px; display: inline-block; vertical-align: middle; margin-right: 8px; }
.orb.listening { animation: pulse .8s ease-in-out infinite; box-shadow: 0 0 26px var(--accent); }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.08); opacity: 1; } }

/* ---- App layout ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(13,20,30,.7);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; letter-spacing: 3px; }
.controls { display: flex; gap: 8px; align-items: center; }
.toggle { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 11px; font-size: 13px; cursor: pointer;
}
.ghost:hover { color: var(--text); border-color: var(--accent-dim); }

.chat { flex: 1; overflow-y: auto; padding: 22px 16px 28px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; max-width: 820px; width: 100%; margin: 0 auto; }
.msg.user { justify-content: flex-end; }
.bubble {
  max-width: 78%; padding: 12px 15px; border-radius: 16px; line-height: 1.55; font-size: 15.5px;
  white-space: pre-wrap; word-wrap: break-word; border: 1px solid var(--line);
}
.msg.user .bubble { background: var(--user); border-bottom-right-radius: 5px; }
.msg.bot .bubble { background: var(--bot); border-bottom-left-radius: 5px; }
.bubble[dir="rtl"] { text-align: right; }
.bubble.typing { color: var(--muted); font-style: italic; }

.composer {
  display: flex; gap: 10px; align-items: flex-end; padding: 12px 16px 18px;
  border-top: 1px solid var(--line); background: rgba(13,20,30,.7); backdrop-filter: blur(8px);
}
.composer textarea {
  flex: 1; resize: none; max-height: 140px; padding: 12px 14px; border-radius: 14px;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line); font-size: 15px; font-family: inherit;
}
.composer textarea:focus { outline: none; border-color: var(--accent-dim); }
.mic, .send { border: none; border-radius: 14px; cursor: pointer; font-weight: 600; }
.mic { width: 50px; height: 48px; font-size: 20px; background: var(--panel); border: 1px solid var(--line); }
.mic.active { background: var(--accent); color: #04222b; box-shadow: 0 0 18px var(--accent); }
.send { padding: 0 20px; height: 48px; background: linear-gradient(180deg, var(--accent), var(--accent-dim)); color: #04222b; }
.send:disabled { opacity: .5; cursor: default; }
@media (max-width: 600px) { .toggle { display: none; } .brand { letter-spacing: 1px; } }
