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

:root {
  --bg: #050505;
  --surface: #0d0d12;
  --surface2: #1a1a24;
  --blue: #4A8FFF;
  --dark-blue: #3a51a3;
  --white: #ffffff;
  --grey: #b4b4b4;
  --dim: #666;
  --radius: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 600px;
  margin: 0 auto;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--surface2);
  flex-shrink: 0;
}

.bob-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.status {
  font-size: 11px;
  color: var(--dim);
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.status.thinking {
  color: var(--blue);
}

.new-chat-btn {
  background: var(--surface2);
  border: none;
  color: var(--grey);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.new-chat-btn:active { background: var(--dark-blue); color: var(--white); }

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: var(--blue);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background: var(--surface2);
  color: var(--grey);
  border-bottom-left-radius: 4px;
}

.message.assistant strong,
.message.assistant b {
  color: var(--white);
}

.message.thinking {
  color: var(--dim);
  font-style: italic;
}

/* Input */
.input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  padding-bottom: max(12px, var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--surface2);
  flex-shrink: 0;
}

#input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--white);
  font-size: 16px;
  font-family: inherit;
  padding: 10px 16px;
  resize: none;
  max-height: 120px;
  outline: none;
  line-height: 1.4;
}

#input:focus {
  border-color: var(--blue);
}

#input::placeholder {
  color: var(--dim);
}

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

.send-btn:active { background: var(--dark-blue); }
.send-btn:disabled { opacity: 0.4; }

/* Setup Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%;
  max-width: 400px;
}

.modal-content h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.modal-content p {
  color: var(--dim);
  font-size: 14px;
  margin-bottom: 20px;
}

.modal-content label {
  display: block;
  font-size: 12px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  margin-top: 16px;
}

.modal-content input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--surface2);
  border-radius: 8px;
  color: var(--white);
  font-size: 15px;
  padding: 10px 12px;
  outline: none;
  font-family: inherit;
}

.modal-content input:focus { border-color: var(--blue); }

.primary-btn {
  display: block;
  width: 100%;
  margin-top: 24px;
  background: var(--blue);
  border: none;
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
}

.primary-btn:active { background: var(--dark-blue); }

/* Scrollbar */
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 2px; }
