:root {
  --navy: #00244D;
  --navy-light: #0E3A6E;
  --orange: #FF7900;
  --orange-light: #FFB766;
  --bg: #F8F6F3;
  --bg-light: #FAFBFC;
  --text: #1A1A1A;
  --text-light: #666;
  --border: #E8E6E1;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ---- Header/Topbar ---- */

.topbar {
  background: linear-gradient(135deg, var(--navy) 0%, #001a3d 100%);
  color: white;
  border-bottom: 4px solid var(--orange);
  box-shadow: 0 4px 12px rgba(0, 36, 77, 0.15);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px 20px;
  gap: 20px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.topbar-mascot {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.topbar-title {
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ghost-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 7px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ---- Chat Shell ---- */

.chat-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  position: relative;
}

.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 20px;
  text-align: center;
  flex: 1;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.welcome.hidden {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.welcome-mascot {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
}

.welcome h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
}

.welcome-sub {
  margin: 0;
  font-size: 15px;
  color: var(--text-light);
  max-width: 500px;
}

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

.msg {
  display: flex;
  gap: 8px;
  max-width: 85%;
  animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-bot {
  align-self: flex-start;
}

.msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--navy);
}

.bubble {
  background: #f0f0f0;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.4;
  max-width: 100%;
}

.msg-user .bubble {
  background: var(--navy);
  color: white;
  border-radius: 14px 4px 14px 14px;
}

.msg-bot .bubble {
  border-radius: 4px 14px 14px 14px;
}

.typing .bubble {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 12px 14px;
}

.dot {
  width: 6px;
  height: 6px;
  background: var(--text-light);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-6px); }
}

/* ---- Composer ---- */

.composer-shell {
  border-top: 1px solid var(--border);
  background: var(--bg-light);
  padding: 12px 20px 20px;
}

.composer {
  display: flex;
  gap: 8px;
  max-width: 900px;
  margin: 0 auto;
}

#chat-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 120px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: white;
}

#chat-input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0, 36, 77, 0.1);
}

#send-btn {
  width: 40px;
  height: 40px;
  background: var(--navy);
  border: 0;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.08s ease;
  flex-shrink: 0;
}

#send-btn:hover {
  background: var(--navy-light);
}

#send-btn:active {
  transform: scale(0.95);
}

#send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.composer-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  margin: 8px 0 0;
}

/* ---- Scrollbar ---- */

.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* ---- Mobile ---- */

@media (max-width: 600px) {
  .topbar-title {
    font-size: 16px;
  }

  .welcome h1 {
    font-size: 22px;
  }

  .msg {
    max-width: 95%;
  }

  .messages {
    padding: 12px;
  }

  .composer-shell {
    padding: 8px 12px 16px;
  }

  .composer {
    max-width: 100%;
  }
}
