:root {
  --bg: #05060b;
  --panel: rgba(12, 15, 28, 0.78);
  --panel-strong: rgba(17, 21, 38, 0.94);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f4f7ff;
  --muted: #a7b0ca;
  --muted-2: #747f9e;
  --accent: #7c5cff;
  --accent-2: #21d4fd;
  --accent-3: #b2ff59;
  --danger: #ff647c;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.46);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(124, 92, 255, 0.32), transparent 32rem),
    radial-gradient(circle at 82% 16%, rgba(33, 212, 253, 0.18), transparent 28rem),
    radial-gradient(circle at 50% 100%, rgba(178, 255, 89, 0.08), transparent 26rem),
    var(--bg);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
}

button, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  padding: 18px;
  gap: 18px;
}

.side-panel, .chat-stage {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.025));
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.side-panel {
  border-radius: 30px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 8px;
}
.brand-orb, .avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: conic-gradient(from 200deg, var(--accent), var(--accent-2), #ffffff, var(--accent));
  color: #070812;
  font-weight: 900;
  box-shadow: 0 0 32px rgba(124, 92, 255, 0.45);
}
.brand-orb { width: 54px; height: 54px; border-radius: 18px; font-size: 1.45rem; }
.brand h1 { margin: 0; letter-spacing: -0.04em; font-size: 2rem; }
.brand p, .panel-card p { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }

.primary-action, .ghost-btn, .chip {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255,255,255,0.06);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.primary-action:hover, .ghost-btn:hover, .chip:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.22); background: rgba(255,255,255,0.1); }
.primary-action {
  width: 100%;
  border-radius: 18px;
  padding: 14px 16px;
  text-align: left;
  font-weight: 750;
  background: linear-gradient(135deg, rgba(124,92,255,.35), rgba(33,212,253,.15));
}

.panel-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  background: rgba(4, 6, 13, 0.28);
}
.panel-card h2 { margin: 0 0 10px; font-size: .82rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.panel-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.panel-card li { color: #dfe6ff; }
.panel-card li::before { content: "✦"; color: var(--accent-2); margin-right: 8px; }
.quiet { margin-top: auto; }

.chat-stage {
  min-width: 0;
  border-radius: 34px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 6, 11, 0.28);
}
.eyebrow { margin: 0; color: var(--accent-2); font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; }
.topbar h2 { margin: 2px 0 0; font-size: 1.36rem; letter-spacing: -.03em; }
.topbar-actions { display: flex; gap: 10px; }
.ghost-btn { border-radius: 999px; padding: 10px 14px; color: #dfe6ff; }

.messages {
  overflow-y: auto;
  padding: 28px min(5vw, 68px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}
.message { display: flex; gap: 13px; max-width: 920px; animation: rise .22s ease both; }
.message.human-message { margin-left: auto; flex-direction: row-reverse; }
.avatar { width: 36px; height: 36px; border-radius: 13px; font-size: .95rem; margin-top: 4px; }
.human-message .avatar { display: none; }
.bubble {
  border: 1px solid var(--line);
  border-radius: 23px;
  padding: 15px 17px;
  background: rgba(255,255,255,0.065);
  color: #edf2ff;
  line-height: 1.55;
  white-space: pre-wrap;
}
.ai-message .bubble { background: rgba(9, 12, 24, 0.58); }
.human-message .bubble {
  background: linear-gradient(135deg, rgba(124,92,255,.88), rgba(83, 111, 255, .76));
  border-color: rgba(255,255,255,.16);
  border-bottom-right-radius: 8px;
  max-width: 760px;
}
.bubble p { margin: 7px 0 0; color: #dae2f9; }
.chips { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.chip { border-radius: 999px; padding: 9px 12px; color: #eaf0ff; }
.thinking { opacity: .8; }
.thinking .bubble::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4,end) infinite; }

.composer {
  margin: 0 min(5vw, 68px) 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 25px;
  padding: 12px;
  background: rgba(5, 6, 11, 0.72);
  box-shadow: 0 18px 52px rgba(0,0,0,.28);
}
textarea {
  width: 100%;
  resize: none;
  border: 0;
  outline: 0;
  min-height: 34px;
  max-height: 180px;
  padding: 8px 9px;
  color: var(--text);
  background: transparent;
  line-height: 1.45;
}
textarea::placeholder { color: var(--muted-2); }
#sendBtn {
  width: 44px; height: 44px;
  border: 0;
  border-radius: 16px;
  display: grid; place-items: center;
  color: #071019;
  background: linear-gradient(135deg, #fff, var(--accent-2));
  box-shadow: 0 10px 28px rgba(33,212,253,.22);
}
#sendBtn svg { width: 21px; height: 21px; fill: currentColor; }
#sendBtn:disabled { opacity: .45; cursor: not-allowed; }

.about-dialog {
  width: min(590px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 26px;
  color: var(--text);
  background: #0d1020;
  box-shadow: var(--shadow);
}
.about-dialog::backdrop { background: rgba(0,0,0,.64); backdrop-filter: blur(8px); }
.about-dialog h2 { margin: 0 0 12px; }
.about-dialog p { color: #d9e1f7; line-height: 1.6; }
.dialog-close { position: absolute; right: 16px; top: 12px; border: 0; background: transparent; color: var(--text); font-size: 2rem; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dots { 0%{content:""} 25%{content:"."} 50%{content:".."} 75%,100%{content:"..."} }

@media (max-width: 850px) {
  body { overflow: auto; }
  .app-shell { min-height: 100%; grid-template-columns: 1fr; padding: 10px; }
  .side-panel { display: none; }
  .chat-stage { min-height: calc(100vh - 20px); border-radius: 25px; }
  .topbar { padding: 16px; }
  .messages { padding: 18px 14px; }
  .composer { margin: 0 12px 14px; }
  .ghost-btn { padding: 9px 11px; }
}
