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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #16213e;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #2a2a4a;
}

header h1 {
  font-size: 16px;
  font-weight: 600;
  color: #7c83ff;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.connected { background: #4caf50; }
.status-dot.disconnected { background: #ff5722; }

button {
  background: #7c83ff;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover { background: #6a71e0; }
button:disabled { cursor: default; }

button.secondary {
  background: transparent;
  border: 1px solid #444;
  color: #aaa;
}

button.secondary:hover { border-color: #7c83ff; color: #7c83ff; }

#single-mode {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.msg.user {
  align-self: flex-end;
  background: #7c83ff;
  color: white;
  border-bottom-right-radius: 4px;
}

.msg.assistant {
  align-self: flex-start;
  background: #2a2a4a;
  color: #e0e0e0;
  border-bottom-left-radius: 4px;
}

.msg.system {
  align-self: center;
  background: transparent;
  color: #888;
  font-size: 12px;
  font-style: italic;
}

.msg .meta {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
}

#input-area {
  background: #16213e;
  padding: 12px 20px;
  display: flex;
  gap: 8px;
  border-top: 1px solid #2a2a4a;
}

#input-area input {
  flex: 1;
  min-width: 0;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  padding: 10px 14px;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
}

#input-area input:focus { border-color: #7c83ff; }
#input-area input::placeholder { color: #555; }

#signed-out-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #888;
}

.typing {
  align-self: flex-start;
  color: #888;
  font-size: 13px;
  padding: 8px 14px;
}

.typing::after {
  content: "...";
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: "."; }
  40% { content: ".."; }
  60%, 100% { content: "..."; }
}

@media (max-width: 720px) {
  header { align-items: flex-start; flex-direction: column; }
  .header-actions { justify-content: flex-start; }
  .msg { max-width: 92%; }
}
