:root {
  --bg: #0d0d0d;
  --bg-panel: rgba(20, 20, 24, 0.7);
  --bg-hover: rgba(35, 35, 42, 0.6);
  --bg-active: rgba(45, 45, 55, 0.8);
  --border: rgba(255, 255, 255, 0.06);
  --text: #f0f0f5;
  --text-dim: #8a8a95;
  --accent: #d4a574;
  --accent-dim: #b8905f;
  --accent-glow: rgba(212, 165, 116, 0.15);
  --error: #e06c75;
  --user-msg: rgba(212, 165, 116, 0.12);
  --ai-msg: rgba(255, 255, 255, 0.03);
  --code-bg: #111116;
  --shadow: rgba(0, 0, 0, 0.3);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
}

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

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  font-size: var(--base-font-size, 14px);
  height: 100vh;
  overflow: hidden;
  transition: background 0.5s ease, color 0.3s ease;
}


body.gradient-dark { background: linear-gradient(135deg, #0a0a0f 0%, #12121a 50%, #0d0d14 100%); }
body.gradient-ocean { background: linear-gradient(135deg, #0a1628 0%, #0d1f3a 50%, #0a2a3a 100%); animation: gradientShift 15s ease infinite; background-size: 200% 200%; }
body.gradient-sunset { background: linear-gradient(135deg, #1a0a14 0%, #2a1020 50%, #1a1530 100%); animation: gradientShift 12s ease infinite; background-size: 200% 200%; }
body.gradient-aurora { background: linear-gradient(135deg, #0a1a10 0%, #0d2a1a 50%, #1a0a2a 100%); animation: gradientShift 18s ease infinite; background-size: 200% 200%; }
body.gradient-nebula { background: linear-gradient(135deg, #0a0a2a 0%, #1a0a2a 50%, #0a1a3a 100%); animation: gradientShift 20s ease infinite; background-size: 200% 200%; }
body.gradient-ember { background: linear-gradient(135deg, #1a0a0a 0%, #2a1510 50%, #1a1015 100%); animation: gradientShift 14s ease infinite; background-size: 200% 200%; }

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}


.top-nav {
  height: 52px;
  background: rgba(20, 20, 24, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  position: relative;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo span {
  color: var(--text);
  font-weight: 500;
  opacity: 0.7;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  margin-left: 28px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.25s ease;
  padding: 6px 10px;
  border-radius: 8px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-glow);
}


.chat-container {
  display: flex;
  height: calc(100vh - 52px);
}

.sidebar {
  width: 260px;
  background: rgba(20, 20, 24, 0.5);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.new-chat-btn {
  width: 100%;
  padding: 10px 14px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.new-chat-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.chat-item {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-dim);
  transition: all 0.2s ease;
}

.chat-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.chat-item.active {
  background: var(--bg-active);
  color: var(--text);
  border: 1px solid var(--border);
}

.model-select {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.model-select label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 1px;
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.model-select select {
  width: 100%;
  padding: 10px 34px 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a95' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.model-select select:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.model-select select option {
  background: rgba(20, 20, 24, 0.95);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 400;
}

.model-select select option.model-divider {
  background: rgba(30, 30, 38, 0.98);
  color: var(--accent);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  cursor: default;
  opacity: 1;
}


.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 0;
  scroll-behavior: smooth;
}

.message {
  max-width: 800px;
  margin: 0 auto 28px;
  padding: 0 28px;
  display: flex;
  gap: 16px;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.message .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.message .avatar.user {
  background: var(--user-msg);
  color: var(--text);
}

.message .avatar.ai-canvas {
  background: transparent;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  padding: 0;
  display: block;
}

.message .avatar.ai-canvas canvas {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: block;
}

.message-content {
  flex: 1;
  line-height: 1.7;
  font-size: calc(var(--base-font-size, 14px) + 1px);
  color: var(--text);
  letter-spacing: -0.01em;
}

.message-content p { margin-bottom: 14px; }

.message-content p:last-child { margin-bottom: 0; }

.message-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.message-content code {
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.05);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--accent);
}

.message-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}


.input-area {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 28px 28px;
  width: 100%;
}

.input-box {
  background: rgba(20, 20, 24, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 24px var(--shadow);
}

.input-box:focus-within {
  border-color: rgba(212, 165, 116, 0.3);
  box-shadow: 0 4px 32px var(--accent-glow), 0 4px 24px var(--shadow);
}

.input-box textarea {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: var(--base-font-size, 14px);
  resize: none;
  outline: none;
  line-height: 1.6;
  max-height: 200px;
  min-height: 24px;
  font-family: inherit;
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  border: none;
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.send-btn:hover {
  opacity: 0.9;
  transform: scale(1.05);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.send-btn:disabled {
  background: var(--bg-active);
  color: var(--text-dim);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 6px 0;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
  opacity: 0.7;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-7px); }
}


.welcome {
  text-align: center;
  padding: 80px 24px;
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.welcome h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.welcome p {
  color: var(--text-dim);
  font-size: 16px;
  margin-bottom: 40px;
  line-height: 1.5;
}

#tagline {
  transition: opacity 0.3s ease;
}

.quick-prompts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quick-prompt {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text);
}

.quick-prompt:hover {
  border-color: rgba(212, 165, 116, 0.2);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.quick-prompt h4 {
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 600;
}

.quick-prompt p {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.4;
}


::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }


.thinking-section {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.thinking-toggle {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
}

.thinking-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.thinking-toggle.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}

.thinking-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.thinking-label {
  flex: 1;
  text-align: left;
}

.thinking-arrow {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.thinking-content {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 1000px;
  }
}

.thinking-inner {
  padding: 14px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
}

.thinking-inner::-webkit-scrollbar {
  width: 4px;
}

.thinking-inner::-webkit-scrollbar-track {
  background: transparent;
}

.thinking-inner::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.thinking-inner strong {
  color: var(--text);
  font-weight: 600;
}

.thinking-inner em {
  color: var(--accent);
  font-style: italic;
}


.tts-welcome {
  text-align: center;
  padding: 60px 24px;
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.tts-icon-large {
  font-size: 80px;
  margin-bottom: 24px;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(100, 200, 255, 0.3));
}

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

.tts-welcome h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.tts-welcome #tagline {
  font-size: 16px;
  color: var(--text-dim);
  margin-bottom: 48px;
}

.tts-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 480px;
}

.tts-feature-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 28px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
  cursor: default;
}

.tts-feature-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.feature-icon-large {
  font-size: 40px;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.tts-feature-card h4 {
  font-size: 16px;
  margin-bottom: 4px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tts-feature-card p {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.5;
}


.tts-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}

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

.tts-feature {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  transition: all 0.3s ease;
}

.tts-feature:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.tts-feature .feature-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
}

.tts-feature h4 {
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 600;
}

.tts-feature p {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
}


.tts-message {
  max-width: 700px;
  margin: 0 auto 24px;
  padding: 0 28px;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tts-user-message {
  background: var(--user-msg);
  border: 1px solid rgba(212, 165, 116, 0.2);
  border-radius: 14px;
  padding: 16px 20px;
}

.tts-ai-message {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  margin-top: 12px;
}

.tts-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 10px;
  font-weight: 600;
}

.tts-text {
  font-size: calc(var(--base-font-size, 14px) + 1px);
  line-height: 1.6;
  color: var(--text);
}


.tts-audio-player {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.tts-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.tts-play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.tts-play-btn:active {
  transform: scale(0.95);
}

.play-icon {
  display: block;
  margin-left: 2px;
}


.tts-waveform {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 48px;
}

.tts-waveform-bar {
  width: 4px;
  height: 20px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.3;
  transition: all 0.3s ease;
}

.tts-waveform.playing .tts-waveform-bar {
  animation: waveform 1s ease-in-out infinite;
}

.tts-waveform.playing .tts-waveform-bar:nth-child(1) { animation-delay: 0s; }
.tts-waveform.playing .tts-waveform-bar:nth-child(2) { animation-delay: 0.1s; }
.tts-waveform.playing .tts-waveform-bar:nth-child(3) { animation-delay: 0.2s; }
.tts-waveform.playing .tts-waveform-bar:nth-child(4) { animation-delay: 0.3s; }
.tts-waveform.playing .tts-waveform-bar:nth-child(5) { animation-delay: 0.4s; }
.tts-waveform.playing .tts-waveform-bar:nth-child(6) { animation-delay: 0.3s; }
.tts-waveform.playing .tts-waveform-bar:nth-child(7) { animation-delay: 0.2s; }
.tts-waveform.playing .tts-waveform-bar:nth-child(8) { animation-delay: 0.1s; }

@keyframes waveform {
  0%, 100% { height: 20px; opacity: 0.3; }
  50% { height: 40px; opacity: 1; }
}

.tts-controls {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.tts-download-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.tts-download-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}


.input-area.tts-mode .input-box {
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.1) 0%, rgba(212, 165, 116, 0.05) 100%);
  border-color: rgba(212, 165, 116, 0.3);
}

.input-area.tts-mode .send-btn {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
}




.beta-warning {
  background: rgba(255, 193, 7, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 193, 7, 0.15);
  padding: 6px 16px;
  position: relative;
  z-index: 100;
  animation: slideDownBeta 0.3s ease;
}

.beta-warning-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.beta-badge {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  border: 1px solid rgba(255, 193, 7, 0.25);
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(255, 193, 7, 0.15);
}

.beta-text {
  color: #e0c060;
  font-size: 13px;
  font-weight: 500;
  flex: 1;
}

.beta-close {
  background: rgba(255, 193, 7, 0.08);
  border: 1px solid rgba(255, 193, 7, 0.15);
  color: #e0c060;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.beta-close:hover {
  background: rgba(255, 193, 7, 0.2);
  border-color: rgba(255, 193, 7, 0.4);
  transform: scale(1.05);
}

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

.ide-container {
  display: flex;
  height: calc(100vh - 52px);
}

.ide-sidebar {
  width: 260px;
  background: rgba(20, 20, 24, 0.5);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.ide-sidebar-header {
  padding: 14px 18px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.ide-sidebar-header button {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s;
}

.ide-sidebar-header button:hover { background: rgba(255,255,255,0.05); }

.file-tree {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  font-size: 13.5px;
}

.file-item {
  padding: 7px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  transition: all 0.15s ease;
  border-radius: 0;
  font-size: 13.5px;
}

.file-item:hover { background: var(--bg-hover); color: var(--text); }

.file-item.active {
  background: var(--bg-active);
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: 15px;
}

.file-item.folder { font-weight: 600; color: var(--text); }

.file-icon { font-size: 14px; width: 18px; text-align: center; font-weight: 600; }

.ide-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.ide-tabs {
  height: 40px;
  background: rgba(20, 20, 24, 0.5);
  border-bottom: 1px solid var(--border);
  display: flex;
  overflow-x: auto;
  backdrop-filter: blur(12px);
}

.ide-tab {
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
  border-right: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  height: 40px;
}

.ide-tab:hover { background: var(--bg-hover); color: var(--text); }

.ide-tab.active {
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  margin-bottom: -1px;
}

.ide-tab-close {
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.ide-tab-close:hover { background: rgba(255,0,0,0.15); color: var(--error); }

.ide-tab:hover .ide-tab-close { opacity: 1; }

.ide-editor-wrapper {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

.ide-editor-area {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

.line-numbers {
  width: 52px;
  background: rgba(20, 20, 24, 0.3);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-dim);
  overflow: hidden;
  user-select: none;
}

.code-editor {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.code-editor textarea {
  width: 100%;
  height: 100%;
  background: transparent;
  color: var(--text);
  border: none;
  outline: none;
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  resize: none;
  tab-size: 2;
}

.ide-statusbar {
  height: 28px;
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}


.ai-panel {
  width: 360px;
  background: rgba(20, 20, 24, 0.5);
  backdrop-filter: blur(12px);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.ai-panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-panel-header .dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-glow);
  animation: pulseGlow 2s ease-in-out infinite;
}

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

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  font-size: 13.5px;
}

.ai-message {
  margin-bottom: 18px;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-message.user { text-align: right; }

.ai-message.user .msg-bubble {
  background: var(--user-msg);
  color: var(--text);
  display: inline-block;
  padding: 10px 14px;
  border-radius: 14px 14px 4px 14px;
  max-width: 100%;
  text-align: left;
  border: 1px solid rgba(212, 165, 116, 0.1);
}

.ai-message.ai .msg-bubble {
  background: rgba(45, 45, 55, 0.6);
  padding: 12px 14px;
  border-radius: 4px 14px 14px 14px;
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.ai-message pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
}

.ai-input-area {
  padding: 14px;
  border-top: 1px solid var(--border);
}

.ai-input-area textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 13.5px;
  resize: none;
  outline: none;
  font-family: inherit;
  min-height: 70px;
  transition: border-color 0.2s;
}

.ai-input-area textarea:focus { border-color: var(--accent-dim); }

.ai-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.ai-actions button {
  flex: 1;
  padding: 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-weight: 500;
}

.ai-actions button:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.ai-actions button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }


.ide-thinking-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.ide-thinking-toggle {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
}

.ide-thinking-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.ide-thinking-toggle.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}

.ide-thinking-toggle .thinking-icon {
  font-size: 14px;
}

.ide-thinking-toggle .thinking-arrow {
  margin-left: auto;
  font-size: 9px;
  color: var(--text-dim);
}

.ide-thinking-content {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
  max-height: 300px;
  overflow-y: auto;
  animation: slideDown 0.3s ease;
}

.ide-thinking-content::-webkit-scrollbar {
  width: 4px;
}

.ide-thinking-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.ide-thinking-content strong {
  color: var(--text);
}

.ide-thinking-content em {
  color: var(--accent);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state h3 { color: var(--text); margin-bottom: 8px; font-size: 15px; font-weight: 600; }


.project-bar {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.project-bar input {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  font-family: var(--font-mono);
}

.project-bar input:focus { border-color: var(--accent-dim); }

.project-bar button {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: var(--accent);
  border: none;
  color: #000;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.project-bar button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}


.file-tree .file-children {
  padding-left: 14px;
  border-left: 1px solid var(--border);
  margin-left: 8px;
}

.file-item .caret {
  font-size: 11px;
  width: 14px;
  display: inline-block;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease;
  color: var(--text-dim);
}

.file-item .caret.collapsed { transform: rotate(-90deg); }


.preview-pane {
  width: 50%;
  min-width: 280px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
}

.preview-header {
  height: 40px;
  background: rgba(20, 20, 24, 0.6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 13px;
  backdrop-filter: blur(12px);
}

.preview-header span { color: var(--text); font-weight: 600; }

.preview-header button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
}

.preview-header button:hover { color: var(--accent); background: rgba(255,255,255,0.05); }

.preview-frame {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
}




body:has(.settings-container) {
  overflow-y: auto;
  overflow-x: hidden;
}


body:has(.settings-container)::-webkit-scrollbar {
  width: 10px;
}

body:has(.settings-container)::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

body:has(.settings-container)::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}

body:has(.settings-container)::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.settings-container {
  padding: 48px 32px 80px;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.settings-header {
  margin-bottom: 48px;
  text-align: center;
}

.settings-header h1 {
  font-size: 42px;
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.settings-header p {
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.6;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 28px;
}

.settings-card {
  background: linear-gradient(135deg, rgba(20, 20, 24, 0.7), rgba(20, 20, 24, 0.5));
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.settings-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.1), 
    transparent);
}

.settings-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3),
              0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: translateY(-4px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-icon {
  font-size: 20px;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border-radius: 12px;
  color: #000;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.card-header h3 {
  font-size: 18px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  gap: 20px;
  transition: all 0.2s ease;
}

.setting-row:hover {
  background: rgba(255, 255, 255, 0.02);
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 10px;
}

.setting-row:last-child { 
  border-bottom: none; 
}

.setting-row label {
  font-size: 14px;
  color: var(--text);
  flex-shrink: 0;
  font-weight: 500;
}

.setting-row select,
.setting-row input[type="number"],
.setting-row textarea {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  min-width: 170px;
  transition: all 0.3s ease;
}

.setting-row select:focus,
.setting-row input[type="number"]:focus,
.setting-row textarea:focus {
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.setting-row select option {
  background: rgba(20, 20, 24, 0.95);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 400;
}

.setting-row select option.model-divider {
  background: rgba(30, 30, 38, 0.98);
  color: var(--accent);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  cursor: default;
  opacity: 1;
}

.setting-row textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
}

.setting-row input[type="range"] {
  flex: 1;
  min-width: 120px;
  accent-color: var(--accent);
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
}

.setting-row input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px var(--accent-glow);
  transition: all 0.2s ease;
}

.setting-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 26px;
  transition: 0.3s;
  border: 1px solid var(--border);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(22px);
  background: #000;
}

.toggle:hover .toggle-slider {
  border-color: rgba(255, 255, 255, 0.2);
}

.settings-footer {
  margin-top: 36px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.save-btn {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 12px 28px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.save-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.save-status {
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}

.danger-btn {
  background: linear-gradient(135deg, rgba(224, 108, 117, 0.15), rgba(224, 108, 117, 0.1));
  color: var(--error);
  border: 1px solid rgba(224, 108, 117, 0.3);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
  font-weight: 600;
}

.danger-btn:hover { 
  background: linear-gradient(135deg, rgba(224, 108, 117, 0.25), rgba(224, 108, 117, 0.15));
  border-color: rgba(224, 108, 117, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(224, 108, 117, 0.2);
}

.btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03));
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
  font-weight: 600;
}

.btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.05));
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}


#particlesCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: -1;
  opacity: 0.6;
}


@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .ai-panel { width: 280px; }
}
