:root {
  --bg-light: #fafafa;
  --bg-dark: #121212;
  --text-light: #333;
  --text-dark: #ddd;
  --user-msg-bg-light: #e1f0ff;
  --bot-msg-bg-light: #e8f5e9;
  --user-msg-bg-dark: #264d73;
  --bot-msg-bg-dark: #2b5d34;
}

body {
  display: flex;
  justify-content: center;  /* center horizontally */
  align-items: center;      /* center vertically */
  height: 100vh;            /* full viewport height */
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', sans-serif;
  background-color: var(--bg-light);
  color: var(--text-light);
  transition: background 0.3s, color 0.3s;
  position: relative;
  overflow-x: hidden;
}

.dark-mode {
  background-color: var(--bg-dark);
  color: var(--text-dark);
}

.page-title {
  text-align: center;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: inherit;
}


#chat-wrapper {
  width: 400px;     /* fixed width */
  height: 600px;    /* fixed height */
  display: flex;
  flex-direction: column;
  padding: 1rem 1.5rem;
  box-sizing: border-box;
  border-radius: 8px;
  background: white;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#mode-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  z-index: 1000;
  transition: color 0.3s;
}

.dark-mode #mode-toggle {
  color: var(--text-dark);
}

#chat {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

#chat::-webkit-scrollbar {
  width: 6px;
}

#chat::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 3px;
}

.message {
  max-width: 80%;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.user {
  align-self: flex-end;
  background-color: var(--user-msg-bg-light);
  color: var(--text-light);
}

.bot {
  align-self: flex-start;
  background-color: var(--bot-msg-bg-light);
  color: var(--text-light);
}

.dark-mode .user {
  background-color: var(--user-msg-bg-dark);
  color: var(--text-dark);
}

.dark-mode .bot {
  background-color: var(--bot-msg-bg-dark);
  color: var(--text-dark);
}

#input-area {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

textarea {
  flex-grow: 1;
  padding: 0.5rem 0.75rem;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #ccc;
  resize: none;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  transition: border-color 0.3s;
}

textarea:focus {
  border-color: #6ca0dc;
  outline: none;
}

button {
  padding: 0.5rem 1.25rem;
  font-size: 14px;
  border: none;
  border-radius: 8px;
  background-color: #6ca0dc;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #5a8ac3;
}

/* Typing animation */
.typing::after {
  content: '';
  display: inline-block;
  animation: dots 1s steps(3, end) infinite;
  width: 1.5ch;
  text-align: left;
  color: inherit;
}

@keyframes dots {
  0% { content: ''; }
  33% { content: '.'; }
  66% { content: '..'; }
  100% { content: '...'; }
}

/* Code rain background */
#code-rain-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  user-select: none;
  background: transparent;
}

.code-line {
  position: absolute;
  color: rgba(0, 0, 0, 0.5);
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  animation: rainDrop linear forwards;
  z-index: 0;
  font-family: 'Courier New', Courier, monospace;
  user-select: none;
}

@keyframes rainDrop {
  0% {
    transform: translateY(-25vh);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(110vh);
    opacity: 0;
  }
}
