:root {
  --bg-primary: #0d0d1a;
  --bg-secondary: #151528;
  --bg-tertiary: #1e1e3f;
  --accent-pink: #ff6b9d;
  --accent-cyan: #00f5d4;
  --accent-purple: #9d4edd;
  --text-primary: #ffffff;
  --text-secondary: #a0a0c0;
  --glass-bg: rgba(30, 30, 63, 0.6);
}

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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: 
    radial-gradient(ellipse at 20% 0%, rgba(157, 78, 221, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(0, 245, 212, 0.1) 0%, transparent 50%),
    var(--bg-primary);
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, rgba(157, 78, 221, 0.2), rgba(21, 21, 40, 0.9));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-mascot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-pink);
}

.app-title {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-sparkle {
  animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.header-right {
  display: flex;
  gap: 0.5rem;
}

.header-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--glass-bg);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
  backdrop-filter: blur(10px);
}

.header-btn:hover {
  background: rgba(255, 107, 157, 0.2);
  transform: scale(1.05);
}

/* Chat Container */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  scroll-behavior: smooth;
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}

.chat-container::-webkit-scrollbar-track {
  background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
  background: rgba(157, 78, 221, 0.3);
  border-radius: 3px;
}

/* Welcome Screen */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 2rem;
}

.welcome-mascot {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin-bottom: 1.5rem;
  border: 3px solid var(--accent-pink);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.welcome-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.welcome-text {
  color: var(--text-secondary);
  max-width: 400px;
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* Suggestions */
.suggestions-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  max-width: 500px;
}

.suggestion-chip {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(157, 78, 221, 0.3);
  border-radius: 20px;
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.suggestion-chip:hover {
  background: rgba(157, 78, 221, 0.3);
  border-color: var(--accent-purple);
  transform: translateY(-2px);
}

/* Messages */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 16px;
  backdrop-filter: blur(10px);
  animation: messageIn 0.3s ease-out;
}

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

.user-message {
  background: linear-gradient(135deg, rgba(157, 78, 221, 0.3), rgba(255, 107, 157, 0.2));
  border: 1px solid rgba(157, 78, 221, 0.3);
}

.ai-message {
  background: var(--glass-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.message-avatar {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.message-content {
  flex: 1;
  overflow: hidden;
}

.message-content p {
  margin-bottom: 0.5rem;
}

.typing-cursor {
  animation: blink 0.8s infinite;
  color: var(--accent-cyan);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Code Block */
.code-block-container {
  background: #0a0a15;
  border: 1px solid rgba(0, 245, 212, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.code-header {
  background: rgba(0, 245, 212, 0.1);
  border-bottom: 1px solid rgba(0, 245, 212, 0.2);
}

.copy-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.launch-btn {
  background: linear-gradient(135deg, #00c896, #00f5d4);
  color: #0a0a15;
  border: none;
  box-shadow: 0 4px 15px rgba(0, 245, 212, 0.3);
}

.launch-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(0, 245, 212, 0.5);
}

.code-content {
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  max-height: 400px;
  overflow: auto;
}

.code-line:hover {
  background: rgba(255, 255, 255, 0.03);
}

.line-number {
  font-size: 0.75rem;
  min-width: 2.5rem;
  color: #555;
}

.line-content {
  white-space: pre;
}

.code-tag { color: #ff79c6; }
.code-attr { color: #50fa7b; }
.code-string { color: #f1fa8c; }
.code-keyword { color: #8be9fd; }
.code-number { color: #bd93f9; }
.code-comment { color: #6272a4; }

/* Input Area */
.input-container {
  padding: 1rem 1.5rem 1.5rem;
  background: linear-gradient(to top, var(--bg-primary), transparent);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  background: var(--glass-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 0.75rem;
  backdrop-filter: blur(10px);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
}

.chat-input::placeholder {
  color: var(--text-secondary);
}

.send-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(255, 107, 157, 0.4);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.input-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.mode-indicator {
  color: var(--accent-cyan);
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 0.75rem;
  font-size: 0.8rem;
}

.app-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.app-footer a:hover {
  color: var(--accent-pink);
}

/* Settings Panel */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}

.settings-panel {
  width: 100%;
  max-width: 360px;
  background: var(--bg-secondary);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.close-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--glass-bg);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1rem;
}

.settings-content {
  padding: 1.25rem;
}

.setting-group {
  margin-bottom: 1.5rem;
}

.setting-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.toggle-group {
  display: flex;
  gap: 0.5rem;
}

.toggle-btn {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: var(--glass-bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn.active {
  background: linear-gradient(135deg, rgba(157, 78, 221, 0.3), rgba(255, 107, 157, 0.2));
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

.setting-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.setting-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 100px;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .app-header {
    padding: 0.75rem 1rem;
  }
  
  .app-title {
    font-size: 1rem;
  }
  
  .header-mascot {
    width: 32px;
    height: 32px;
  }
  
  .chat-container {
    padding: 1rem;
  }
  
  .message {
    padding: 0.75rem;
    max-width: 95% !important;
  }
  
  .welcome-mascot {
    width: 80px;
    height: 80px;
  }
  
  .welcome-title {
    font-size: 1.25rem;
  }
  
  .input-container {
    padding: 0.75rem 1rem 1rem;
  }
  
  .code-content {
    font-size: 0.7rem;
  }
  
  .settings-panel {
    max-width: 100%;
  }
}