:root {
  --bg: #0b0f1a;
  --surface: #131a2a;
  --surface-2: #1b2436;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --text: #e7ebf5;
  --text-dim: #8b93a7;
  --bubble-in: #1b2436;
  --bubble-out: #4f46e5;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 14px;
  background: var(--surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.topbar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.topbar-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.topbar-info strong {
  font-size: 15px;
}

#status-line {
  font-size: 12px;
  color: var(--text-dim);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-dim);
}

.card p {
  margin: 0 0 10px;
}

.hidden {
  display: none;
}

.btn-secondary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:active {
  opacity: 0.85;
}

.chat-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-log li {
  max-width: 78%;
  align-self: flex-end;
  background: var(--bubble-out);
  color: #fff;
  padding: 8px 12px;
  border-radius: 14px 14px 4px 14px;
  font-size: 14px;
  line-height: 1.35;
}

.chat-log li .bubble-sender {
  display: block;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.75;
  margin-bottom: 2px;
}

.chat-log li .bubble-time {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.65;
  text-align: right;
}

.chat-log .empty-hint {
  align-self: center;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  padding: 24px 12px;
  text-align: center;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
  background: var(--surface);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.composer input,
.composer textarea {
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
}

.composer input {
  width: 96px;
  flex-shrink: 0;
}

.composer textarea {
  flex: 1;
  max-height: 90px;
}

.composer input:focus,
.composer textarea:focus {
  border-color: var(--accent-2);
}

.btn-send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.btn-send:active {
  opacity: 0.85;
}
