:root {
  --bg0: #0c0a12;
  --bg1: #120e1f;
  --bg2: #1a1530;
  --ink: #e9ecff;
  --ink-dim: #c4c8e0;
  --neon: #b44dff;
  --neon-2: #9a3cda;
  --neon-3: #7a26c4;
  --accent: #ff5ec1;
  --accent-2: #ff8cc8;
  --ok: #4ade80;
  --err: #ff5c7a;
  --warn: #facc15;
  --shadow: 0 10px 30px rgba(0,0,0,.55);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", sans-serif;
  background: var(--bg0);
  color: var(--ink);
}
#app { height: 100%; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* Layout */
.stack { display: flex; flex-direction: column; gap: 14px; }
.center { display: flex; align-items: center; justify-content: center; }
.hero { height: 100%; }

/* Card */
.card {
  background: linear-gradient(180deg, var(--bg2), var(--bg1));
  border: 1px solid rgba(180,77,255,.18);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

/* Typography */
.title {
  font-weight: 900;
  letter-spacing: .2px;
  background: linear-gradient(90deg, var(--ink) 0%, var(--accent-2) 50%, var(--neon) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle { color: var(--ink-dim); }

/* Form */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
label { font-size: 13px; color: var(--ink-dim); }
input {
  width: 100%;
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: #0f0d18;
  color: var(--ink);
  outline: none;
}
input:focus { border-color: var(--neon); box-shadow: 0 0 0 3px rgba(180,77,255,.25); }

button {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 800;
  color: white;
  background: linear-gradient(180deg, var(--neon), var(--neon-2));
  box-shadow: 0 20px 30px rgba(180,77,255,.25);
}
button.ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: none;
  color: var(--ink-dim);
}

/* Nav */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  background: rgba(18,14,31,.85);
  backdrop-filter: blur(10px);
}
.small { width: 28px; height: 28px; border-radius: 10px; padding: 0; }

/* Room list */
.room {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.room:hover { background: rgba(180,77,255,.08); }

/* Chat */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 84%;
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.35;
  word-wrap: break-word;
}
.bubble.me {
  align-self: flex-end;
  background: linear-gradient(180deg, var(--neon-3), var(--neon-2));
  border: 1px solid rgba(180,77,255,.4);
  color: white;
}
.bubble.theirs {
  align-self: flex-start;
  background: #15112a;
  border: 1px solid rgba(255,255,255,.08);
  color: var(--ink);
}
.meta { font-size: 11px; color: var(--ink-dim); opacity: .85; margin-top: 6px; }

.inputbar {
  display: flex;
  gap: 10px;
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(255,255,255,.05);
  background: rgba(18,14,31,.85);
  backdrop-filter: blur(10px);
}

/* Toast */
.toast {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 12px;
  background: #1a1530;
  border: 1px solid rgba(255,255,255,.1);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  z-index: 50;
  opacity: .98;
}

/* Spinner */
.spin {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: var(--neon);
  border-radius: 50%;
  animation: rot .8s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }
