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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #d4c4b0 0%, #c9b9a5 50%, #bea990 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
  overflow: auto;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(205, 127, 50, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(72, 118, 108, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#app {
  width: 100%;
  max-width: 900px;
  position: relative;
  z-index: 1;
}

.chat-container {
  background: linear-gradient(145deg, #b8845f, #9a6d4a);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 3px rgba(255, 255, 255, 0.2),
    inset 0 -1px 3px rgba(0, 0, 0, 0.3);
  border: 3px solid #6d5544;
  position: relative;
}

.chat-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.03) 2px,
      rgba(0, 0, 0, 0.03) 4px
    );
  pointer-events: none;
  opacity: 0.5;
}

/* Header */
.chat-header {
  background: linear-gradient(135deg, #a0724b 0%, #8b5e3c 100%);
  padding: 25px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 3px solid #6d5544;
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.2);
  position: relative;
}

.chat-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.2) 50%, 
    transparent
  );
}

.rusty-avatar {
  width: 80px;
  height: 80px;
  background: linear-gradient(145deg, #cd7f32, #b87333);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  border: 2px solid #8b5e3c;
  position: relative;
}

.rusty-avatar::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 10%;
  width: 30%;
  height: 15%;
  background: rgba(112, 169, 161, 0.6);
  border-radius: 3px;
  filter: blur(2px);
}

.rusty-avatar::after {
  content: '';
  position: absolute;
  bottom: 15%;
  right: 15%;
  width: 25%;
  height: 20%;
  background: rgba(112, 169, 161, 0.4);
  border-radius: 50%;
  filter: blur(3px);
}

.robot-head {
  position: relative;
  width: 90%;
  height: 90%;
}

.antenna {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 12px;
  background: #6d5544;
}

.antenna::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: #70a9a1;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(112, 169, 161, 0.8);
}

.eyes {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  display: flex;
  justify-content: space-around;
}

.eye {
  width: 16px;
  height: 16px;
  background: radial-gradient(circle at 35% 35%, #4a3428, #2a1f1a);
  border-radius: 50%;
  border: 2px solid #d4af97;
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.6),
    0 1px 2px rgba(255, 255, 255, 0.3);
  animation: blink 4s infinite;
}

@keyframes blink {
  0%, 48%, 52%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.1); }
}

.mouth {
  position: absolute;
  bottom: 25%;
  left: 50%;
  transform: translateX(-50%);
  width: 35%;
  height: 4px;
  background: #2a1f1a;
  border-radius: 2px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
}

.header-info {
  flex: 1;
  color: #f5e6d3;
}

.header-info h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 5px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
  letter-spacing: 1px;
}

.subtitle {
  font-size: 14px;
  color: #d4c4b0;
  margin-bottom: 8px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #e0d5c7;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #70a9a1;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(112, 169, 161, 0.8);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

/* Messages */
.chat-messages {
  height: 500px;
  overflow-y: auto;
  padding: 25px;
  background: linear-gradient(to bottom, rgba(210, 180, 140, 0.3), rgba(184, 134, 11, 0.2));
  position: relative;
}

.chat-messages::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(112, 169, 161, 0.05) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(205, 127, 50, 0.05) 0%, transparent 20%),
    radial-gradient(circle at 50% 50%, rgba(160, 114, 75, 0.03) 0%, transparent 30%);
  pointer-events: none;
}

.message {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  animation: slideIn 0.3s ease-out;
  position: relative;
}

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

.message-avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 2px solid;
}

.rusty-message .message-avatar {
  background: linear-gradient(145deg, #cd7f32, #b87333);
  color: #2a1f1a;
  border-color: #8b5e3c;
  position: relative;
}

.rusty-message .message-avatar::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  background: rgba(112, 169, 161, 0.5);
  border-radius: 50%;
}

.user-message {
  flex-direction: row-reverse;
}

.user-message .message-avatar {
  background: linear-gradient(145deg, #70a9a1, #5c8a83);
  color: #f5e6d3;
  border-color: #4a6b66;
}

.message-content {
  flex: 1;
  max-width: 70%;
}

.message-header {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  opacity: 0.9;
}

.rusty-message .message-header {
  color: #8b5e3c;
}

.user-message .message-header {
  color: #4a6b66;
  text-align: right;
}

.message-text {
  background: linear-gradient(145deg, #f5e6d3, #e8d7c3);
  padding: 14px 18px;
  border-radius: 12px;
  line-height: 1.6;
  color: #3a2f25;
  box-shadow: 
    0 3px 10px rgba(0, 0, 0, 0.2),
    inset 0 1px 2px rgba(255, 255, 255, 0.5);
  border: 1px solid #d4c4b0;
  position: relative;
  font-size: 15px;
}

.rusty-message .message-text {
  border-radius: 12px 12px 12px 4px;
}

.user-message .message-text {
  background: linear-gradient(145deg, #8bb5af, #70a9a1);
  color: #f5e6d3;
  border-color: #5c8a83;
  border-radius: 12px 12px 4px 12px;
}

/* Input */
.chat-input-container {
  background: linear-gradient(135deg, #8b5e3c 0%, #6d4a35 100%);
  padding: 20px;
  border-top: 3px solid #5a3d2b;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.input-wrapper {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

#userInput {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid #6d5544;
  border-radius: 10px;
  font-size: 15px;
  background: linear-gradient(145deg, #f5e6d3, #e8d7c3);
  color: #3a2f25;
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.15),
    0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

#userInput:focus {
  outline: none;
  border-color: #70a9a1;
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.15),
    0 0 0 3px rgba(112, 169, 161, 0.3);
}

#userInput::placeholder {
  color: #9a8675;
}

.send-button {
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(145deg, #70a9a1, #5c8a83);
  color: #f5e6d3;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 
    0 3px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.2);
  border: 2px solid #4a6b66;
}

.send-button:hover {
  background: linear-gradient(145deg, #7dbdb4, #6a9d95);
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.4);
}

.send-button:active {
  transform: translateY(0);
}

.quick-questions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-btn {
  padding: 8px 16px;
  background: linear-gradient(145deg, rgba(205, 127, 50, 0.4), rgba(184, 115, 51, 0.4));
  border: 1px solid #a0724b;
  border-radius: 20px;
  color: #f5e6d3;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.quick-btn:hover {
  background: linear-gradient(145deg, rgba(205, 127, 50, 0.6), rgba(184, 115, 51, 0.6));
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 10px;
}

.chat-messages::-webkit-scrollbar-track {
  background: rgba(109, 85, 68, 0.3);
  border-radius: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #8b5e3c, #6d4a35);
  border-radius: 5px;
  border: 2px solid rgba(109, 85, 68, 0.3);
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #a0724b, #8b5e3c);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: linear-gradient(145deg, #b8845f, #9a6d4a);
  border-radius: 15px;
  padding: 0;
  max-width: 500px;
  width: 90%;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 3px rgba(255, 255, 255, 0.2);
  border: 3px solid #6d5544;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  background: linear-gradient(135deg, #a0724b 0%, #8b5e3c 100%);
  padding: 25px;
  border-radius: 12px 12px 0 0;
  border-bottom: 2px solid #6d5544;
}

.modal-header h2 {
  color: #f5e6d3;
  font-size: 24px;
  margin-bottom: 8px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-header p {
  color: #d4c4b0;
  font-size: 14px;
  margin: 0;
}

.modal-body {
  padding: 25px;
}

.modal-body label {
  display: block;
  color: #f5e6d3;
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 14px;
}

.modal-body input[type="password"],
.modal-body input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #6d5544;
  border-radius: 8px;
  font-size: 14px;
  background: linear-gradient(145deg, #f5e6d3, #e8d7c3);
  color: #3a2f25;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
  font-family: 'Courier New', monospace;
}

.modal-body input:focus {
  outline: none;
  border-color: #70a9a1;
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.15),
    0 0 0 3px rgba(112, 169, 161, 0.3);
}

.modal-help {
  margin-top: 12px;
  font-size: 13px;
  color: #d4c4b0;
}

.modal-help a {
  color: #70a9a1;
  text-decoration: none;
  font-weight: 600;
}

.modal-help a:hover {
  text-decoration: underline;
}

.modal-note {
  margin-top: 15px;
  padding: 12px;
  background: rgba(112, 169, 161, 0.2);
  border-radius: 8px;
  font-size: 12px;
  color: #e0d5c7;
  border-left: 3px solid #70a9a1;
}

.modal-footer {
  padding: 20px 25px;
  display: flex;
  gap: 12px;
  border-top: 2px solid #6d5544;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0 0 12px 12px;
}

.modal-button {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.modal-button.primary {
  background: linear-gradient(145deg, #70a9a1, #5c8a83);
  color: #f5e6d3;
  border: 2px solid #4a6b66;
}

.modal-button.primary:hover {
  background: linear-gradient(145deg, #7dbdb4, #6a9d95);
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.4);
}

.modal-button.secondary {
  background: linear-gradient(145deg, rgba(160, 114, 75, 0.6), rgba(139, 94, 60, 0.6));
  color: #f5e6d3;
  border: 2px solid #8b5e3c;
}

.modal-button.secondary:hover {
  background: linear-gradient(145deg, rgba(160, 114, 75, 0.8), rgba(139, 94, 60, 0.8));
  transform: translateY(-2px);
}

.header-buttons {
  display: flex;
  gap: 8px;
}

.settings-btn {
  background: linear-gradient(145deg, rgba(205, 127, 50, 0.4), rgba(184, 115, 51, 0.4));
  border: 1px solid #a0724b;
  border-radius: 8px;
  color: #f5e6d3;
  font-size: 18px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-btn:hover {
  background: linear-gradient(145deg, rgba(205, 127, 50, 0.6), rgba(184, 115, 51, 0.6));
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.status-dot.offline {
  background: #9a6d4a;
  box-shadow: 0 0 8px rgba(154, 109, 74, 0.6);
}

.status-dot.ai-powered {
  background: linear-gradient(45deg, #70a9a1, #4a6b66);
  box-shadow: 0 0 12px rgba(112, 169, 161, 1);
}

/* Responsive */
@media (max-width: 768px) {
  .chat-container {
    border-radius: 15px;
  }
  
  .chat-header {
    padding: 20px;
  }
  
  .rusty-avatar {
    width: 60px;
    height: 60px;
  }
  
  .header-info h1 {
    font-size: 22px;
  }
  
  .chat-messages {
    height: 400px;
    padding: 15px;
  }
  
  .message-content {
    max-width: 80%;
  }
  
  .quick-questions {
    flex-direction: column;
  }
  
  .quick-btn {
    width: 100%;
  }
  
  .modal-content {
    width: 95%;
    max-width: 400px;
  }
  
  .modal-footer {
    flex-direction: column;
  }
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px;
  align-items: center;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #8b5e3c;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}
