/* TAI Platform - Main Stylesheet */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { overscroll-behavior: none; }

:root {
  --bg: #06060e;
  --bg-secondary: #0c0c18;
  --bg-card: rgba(255,255,255,0.02);
  --sidebar: #09091a;
  --editor: #06060e;
  --border: rgba(255,255,255,0.05);
  --border-light: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.12);
  --text: #b0b0c4;
  --text-dim: #555570;
  --text-bright: #e8e8f4;
  --text-white: #ffffff;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --accent-glow: rgba(108,92,231,0.25);
  --cyan: #00d2ff;
  --cyan-glow: rgba(0,210,255,0.2);
  --green: #00f5a0;
  --green-glow: rgba(0,245,160,0.2);
  --red: #ff6b6b;
  --yellow: #ffd93d;
  --orange: #ff9f43;
  --pink: #fd79a8;
  --hover: rgba(255,255,255,0.03);
  --active: rgba(108,92,231,0.08);
  --gradient-primary: linear-gradient(135deg, #6c5ce7, #00d2ff);
  --gradient-warm: linear-gradient(135deg, #ff6b6b, #ffd93d);
  --gradient-cool: linear-gradient(135deg, #00f5a0, #00d2ff);
  --gradient-purple: linear-gradient(135deg, #6c5ce7, #fd79a8);
  --shadow-glow: 0 0 60px rgba(108,92,231,0.15);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ================================================================
   WELCOME / LANDING PAGE
   ================================================================ */
.welcome {
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
}

/* Animated mesh gradient background */
.welcome-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg);
}
.welcome-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(108,92,231,0.12), transparent),
    radial-gradient(ellipse 60% 80% at 80% 30%, rgba(0,210,255,0.08), transparent),
    radial-gradient(ellipse 70% 50% at 50% 80%, rgba(253,121,168,0.06), transparent);
  animation: mesh-shift 20s ease-in-out infinite alternate;
}
@keyframes mesh-shift {
  0% { opacity: 1; transform: scale(1) translate(0,0); }
  50% { opacity: 0.8; transform: scale(1.05) translate(-2%,3%); }
  100% { opacity: 1; transform: scale(1) translate(2%,-2%); }
}

/* Grid pattern */
.welcome-grid {
  position: fixed;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(rgba(108,92,231,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108,92,231,0.03) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 80% 70% at center, black 20%, transparent 70%);
}

/* Floating particles */
.particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(108,92,231,0.4);
  animation: particle-float linear infinite;
}
@keyframes particle-float {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* Sections */
.welcome-section {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
}

/* ---- HERO ---- */
.hero {
  text-align: center;
  max-width: 720px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(108,92,231,0.1);
  border: 1px solid rgba(108,92,231,0.2);
  border-radius: 100px;
  padding: 6px 18px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
  letter-spacing: 0.5px;
  margin-bottom: 32px;
  animation: fade-in-up 0.6s ease-out;
}
.hero-badge .pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 4px var(--green); }
  50% { box-shadow: 0 0 12px var(--green), 0 0 24px rgba(0,245,160,0.3); }
}

.hero-logo {
  font-size: 72px;
  font-weight: 900;
  letter-spacing: 10px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  margin-bottom: 8px;
  animation: fade-in-up 0.6s ease-out 0.1s backwards;
  position: relative;
}
.hero-logo::after {
  content: 'TAI';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: blur(40px);
  opacity: 0.4;
  z-index: -1;
}

.hero-tagline {
  font-size: 18px;
  color: var(--text-dim);
  font-weight: 300;
  letter-spacing: 4px;
  margin-bottom: 24px;
  animation: fade-in-up 0.6s ease-out 0.2s backwards;
}

.hero-desc {
  font-size: 16px;
  color: var(--text);
  line-height: 1.7;
  max-width: 480px;
  margin: 0 auto 40px;
  animation: fade-in-up 0.6s ease-out 0.3s backwards;
}

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

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 40px;
  justify-content: center;
  margin-bottom: 48px;
  animation: fade-in-up 0.6s ease-out 0.4s backwards;
}
.stat-item {
  text-align: center;
}
.stat-num {
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: 'JetBrains Mono', monospace;
}
.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* MCP feature cards */
.mcp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 640px;
  margin-bottom: 48px;
  animation: fade-in-up 0.6s ease-out 0.5s backwards;
}
.mcp-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 10px;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  cursor: default;
}
.mcp-card:hover {
  background: rgba(108,92,231,0.06);
  border-color: rgba(108,92,231,0.2);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(108,92,231,0.1);
}
.mcp-card .mcp-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 18px;
}
.mcp-card:nth-child(1) .mcp-icon { background: rgba(108,92,231,0.12); }
.mcp-card:nth-child(2) .mcp-icon { background: rgba(0,210,255,0.12); }
.mcp-card:nth-child(3) .mcp-icon { background: rgba(0,245,160,0.12); }
.mcp-card:nth-child(4) .mcp-icon { background: rgba(253,121,168,0.12); }
.mcp-card:nth-child(5) .mcp-icon { background: rgba(255,157,67,0.12); }
.mcp-card:nth-child(6) .mcp-icon { background: rgba(255,217,61,0.12); }
.mcp-card:nth-child(7) .mcp-icon { background: rgba(0,210,255,0.12); }
.mcp-card:nth-child(8) .mcp-icon { background: rgba(108,92,231,0.12); }
.mcp-card .mcp-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Auth box */
.auth-container {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  animation: fade-in-up 0.6s ease-out 0.6s backwards;
}
.auth-box {
  background: rgba(255,255,255,0.02);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.04);
  position: relative;
  overflow: hidden;
}
.auth-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(108,92,231,0.3), rgba(0,210,255,0.3), transparent);
}

.auth-tabs {
  display: flex;
  margin-bottom: 28px;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s;
  font-family: 'Inter', sans-serif;
}
.auth-tab.active {
  color: #fff;
  background: rgba(108,92,231,0.2);
  box-shadow: 0 2px 12px rgba(108,92,231,0.15);
}
.auth-tab:hover:not(.active) { color: var(--text); }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form input {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text-bright);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all 0.3s;
}
.auth-form input::placeholder { color: var(--text-dim); }
.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,92,231,0.08), 0 0 20px rgba(108,92,231,0.05);
}
.auth-form .btn {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.auth-form .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(108,92,231,0.35);
}
.auth-form .btn:active { transform: translateY(0); }

.auth-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
  min-height: 20px;
  text-align: center;
}

/* Powered by */
.powered-section {
  margin-top: 32px;
  text-align: center;
}
.powered-text {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.6;
}
.tech-stack {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 16px;
  opacity: 0.4;
}
.tech-tag {
  font-size: 10px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 10px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
}

/* ---- MCP SHOWCASE SECTION ---- */
.mcp-showcase {
  min-height: auto;
  padding: 80px 24px;
}
.section-header {
  text-align: center;
  margin-bottom: 60px;
}
.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.section-title {
  font-size: 36px;
  font-weight: 800;
  color: var(--text-white);
  margin-bottom: 16px;
  line-height: 1.2;
}
.section-desc {
  font-size: 16px;
  color: var(--text-dim);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

.mcp-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 900px;
  width: 100%;
}
.mcp-feature {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
}
.mcp-feature::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.3s;
}
.mcp-feature:hover {
  background: rgba(255,255,255,0.03);
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.mcp-feature:hover::before { opacity: 1; }
.mcp-feature .feat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}
.mcp-feature:nth-child(1) .feat-icon { background: rgba(108,92,231,0.12); }
.mcp-feature:nth-child(2) .feat-icon { background: rgba(0,210,255,0.12); }
.mcp-feature:nth-child(3) .feat-icon { background: rgba(0,245,160,0.12); }
.mcp-feature:nth-child(4) .feat-icon { background: rgba(253,121,168,0.12); }
.mcp-feature:nth-child(5) .feat-icon { background: rgba(255,157,67,0.12); }
.mcp-feature:nth-child(6) .feat-icon { background: rgba(255,217,61,0.12); }
.mcp-feature .feat-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 8px;
}
.mcp-feature .feat-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}
.mcp-feature .feat-tag {
  display: inline-block;
  margin-top: 12px;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-light);
  background: rgba(108,92,231,0.08);
  border: 1px solid rgba(108,92,231,0.15);
  border-radius: 4px;
  padding: 2px 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ================================================================
   IDE LAYOUT
   ================================================================ */
.ide {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Title bar */
.titlebar {
  height: 42px;
  background: linear-gradient(90deg, #0a0a1a, #0e0d20, #0a0a1a);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.titlebar .left { display: flex; align-items: center; gap: 12px; }
.titlebar .title {
  font-weight: 800;
  letter-spacing: 3px;
  font-size: 13px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.titlebar .uid {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.03);
  padding: 2px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.titlebar .mcp-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--green);
  background: rgba(0,245,160,0.06);
  border: 1px solid rgba(0,245,160,0.12);
  padding: 3px 10px;
  border-radius: 100px;
}
.titlebar .mcp-status .mcp-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-glow 2s ease-in-out infinite;
}
.titlebar .right-btns {
  display: flex;
  gap: 6px;
}
.titlebar .tb-btn {
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.titlebar .tb-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-bright);
  border-color: var(--border-hover);
}
.titlebar .tb-btn.preview-btn { border-color: rgba(0,245,160,0.15); color: var(--green); }
.titlebar .tb-btn.preview-btn:hover { background: rgba(0,245,160,0.06); }
.titlebar .tb-btn.chat-btn { border-color: rgba(108,92,231,0.2); color: var(--accent-light); }
.titlebar .tb-btn.chat-btn:hover { background: rgba(108,92,231,0.06); }
.titlebar .tb-btn.run-btn { border-color: rgba(0,210,255,0.2); color: var(--cyan); }
.titlebar .tb-btn.run-btn:hover { background: rgba(0,210,255,0.06); }
.titlebar .tb-btn.stop-btn { border-color: rgba(255,107,107,0.25); color: var(--red); background: rgba(255,107,107,0.04); }
.titlebar .tb-btn.stop-btn:hover { background: rgba(255,107,107,0.1); }
.titlebar .tb-btn.subscribe-btn {
  background: linear-gradient(135deg, #6c5ce7, #00d2ff);
  border: none;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 6px 14px;
  border-radius: 8px;
  animation: sub-pulse 2s ease-in-out infinite;
}
.titlebar .tb-btn.subscribe-btn:hover {
  background: linear-gradient(135deg, #5a4bd6, #00b8e6);
  box-shadow: 0 0 16px rgba(108,92,231,0.4);
  transform: translateY(-1px);
}
@keyframes sub-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(108,92,231,0.3); }
  50% { box-shadow: 0 0 12px 2px rgba(108,92,231,0.2); }
}

/* Main body */
.main-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 260px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header {
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.sidebar-actions {
  display: flex;
  gap: 2px;
}
.sidebar-actions button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: all 0.2s;
}
.sidebar-actions button:hover { background: var(--hover); color: var(--text-bright); }

/* MCP Tools Panel */
.mcp-tools-panel {
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
}
.mcp-tools-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mcp-tools-header .mcp-live {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-glow 2s ease-in-out infinite;
}
.mcp-tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.mcp-tool-tag {
  font-size: 10px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.2s;
}
.mcp-tool-tag:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: rgba(108,92,231,0.06);
}
.mcp-tool-tag.active {
  border-color: rgba(0,245,160,0.2);
  color: var(--green);
  background: rgba(0,245,160,0.04);
}

.file-tree {
  flex: 1;
  overflow-y: auto;
  font-size: 13px;
  padding: 4px 0;
}
.file-tree::-webkit-scrollbar { width: 5px; }
.file-tree::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }

/* Version History Section */
.version-section {
  border-top: 1px solid var(--border);
}
.version-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.2s;
}
.version-header:hover { color: var(--text-primary); }
.version-toggle { font-size: 10px; transition: transform 0.2s; }
.version-toggle.open { transform: rotate(90deg); }
.version-list {
  max-height: 200px;
  overflow-y: auto;
  padding: 0 8px 8px;
}
.version-list::-webkit-scrollbar { width: 4px; }
.version-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 2px; }
.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s;
  gap: 6px;
}
.version-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.version-item .v-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.version-item .v-meta {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.version-item .v-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.version-item:hover .v-actions { opacity: 1; }
.version-item .v-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 3px;
}
.version-item .v-btn:hover { background: rgba(108,92,231,0.15); }
.version-item .v-btn.danger { color: #ff4757; }
.version-item .v-btn.danger:hover { background: rgba(255,71,87,0.15); }
.version-empty {
  text-align: center;
  padding: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.tree-item {
  display: flex;
  align-items: center;
  padding: 5px 14px;
  cursor: pointer;
  gap: 6px;
  white-space: nowrap;
  user-select: none;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}
.tree-item:hover { background: var(--hover); }
.tree-item.active { background: var(--active); border-left-color: var(--accent); }
.tree-item .icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.tree-item .name { overflow: hidden; text-overflow: ellipsis; }
.tree-item.dir .icon { color: var(--yellow); }
.tree-item.file .icon { color: var(--accent-light); }
.tree-children { padding-left: 16px; }

/* Context menu */
.ctx-menu {
  position: fixed;
  background: rgba(12,12,24,0.96);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px 0;
  min-width: 180px;
  z-index: 999;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  font-size: 13px;
}
.ctx-menu .item {
  padding: 8px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}
.ctx-menu .item:hover { background: rgba(108,92,231,0.12); color: #fff; }
.ctx-menu .sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ===== Resizer Handle ===== */
.resizer {
  width: 5px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  transition: background 0.2s;
}
.resizer::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 1px;
  width: 3px;
  background: transparent;
  transition: background 0.2s;
}
.resizer:hover::after, .resizer.active::after {
  background: var(--accent);
}
.resizer:hover, .resizer.active {
  background: rgba(108,92,231,0.08);
}

/* ===== Editor Area ===== */
.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  padding: 9px 16px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active {
  background: var(--bg);
  color: var(--text-bright);
  border-bottom: 2px solid var(--accent);
  margin-bottom: -1px;
}
.tab .close { font-size: 14px; opacity: 0; padding: 0 2px; border-radius: 3px; }
.tab:hover .close { opacity: 0.5; }
.tab .close:hover { opacity: 1; background: rgba(255,255,255,.06); }
.tab .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); display: none; }
.tab.modified .dot { display: block; }
.tab.modified .close { display: none; }

.editor-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.editor-content textarea {
  width: 100%;
  height: 100%;
  background: var(--editor);
  color: #d4d4d4;
  border: none;
  padding: 14px 18px;
  font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.7;
  resize: none;
  outline: none;
  tab-size: 2;
}
.editor-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 14px;
  gap: 8px;
}
.editor-empty::before {
  content: '{ }';
  font-size: 36px;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(108,92,231,0.1);
  font-weight: 700;
}

/* Status bar */
.statusbar {
  height: 28px;
  background: linear-gradient(90deg, #0a0a1a, #0e0c20, #0a0a1a);
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  justify-content: space-between;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}
.statusbar .mcp-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-size: 10px;
}
.statusbar .mcp-indicator .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
}

/* ===== Chat Panel ===== */
.chat-overlay {
  position: fixed;
  right: 0;
  top: 42px;
  bottom: 0;
  width: 400px;
  background: rgba(8,8,18,0.96);
  backdrop-filter: blur(24px);
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.chat-overlay.open { transform: translateX(0); }

.chat-resizer {
  position: absolute;
  left: -3px;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 101;
  background: transparent;
  transition: background 0.2s;
}
.chat-resizer:hover,
.chat-resizer.active {
  background: var(--accent);
}

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-header .chat-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-header .chat-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-bright);
}
.chat-header .model-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(0,210,255,0.08);
  border: 1px solid rgba(0,210,255,0.15);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: 'JetBrains Mono', monospace;
}
/* Agent mode toggle */
.mode-toggle {
  display: flex;
  gap: 8px;
  flex: 1;
}
.mode-toggle .mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.03);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.25s;
  font-family: 'Inter', sans-serif;
}
.mode-toggle .mode-btn .mode-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.mode-toggle .mode-btn .mode-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  display: block;
  line-height: 1.2;
}
.mode-toggle .mode-btn .mode-desc {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.6;
}
.mode-toggle .mode-btn.active {
  border-color: var(--accent);
  background: rgba(108,92,231,0.08);
}
.mode-toggle .mode-btn.active .mode-label {
  color: var(--accent-light);
}
.mode-toggle .mode-btn.active .mode-desc {
  color: var(--accent-light);
  opacity: 0.8;
}
.mode-toggle .mode-btn:not(.active):hover {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
}

/* Agent steps in chat */
.agent-steps {
  background: rgba(108,92,231,0.06);
  border: 1px solid rgba(108,92,231,0.12);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 8px 0;
  max-width: 85%;
}
.agent-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-dim);
  transition: all 0.3s;
}
.agent-step.active {
  color: var(--accent-light);
  font-weight: 500;
}
.agent-step.done {
  color: var(--green);
}
.agent-step .step-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.agent-step.pending .step-icon {
  border: 2px solid var(--border);
  color: var(--text-dim);
}
.agent-step.active .step-icon {
  background: var(--accent);
  color: #fff;
  animation: agentPulse 1.5s ease-in-out infinite;
}
.agent-step.done .step-icon {
  background: var(--green);
  color: #fff;
}
@keyframes agentPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(108,92,231,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(108,92,231,0); }
}

/* Agent mode indicator on input */
.chat-input-area.agent-mode .chat-input-wrap {
  border-color: rgba(108,92,231,0.3);
  background: rgba(108,92,231,0.04);
}
.agent-label {
  display: none;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 14px 0;
}
.chat-input-area.agent-mode .agent-label { display: block; }

.chat-header .close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.chat-header .close-btn:hover { background: var(--hover); color: var(--text-bright); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.05); border-radius: 2px; }

.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
}
.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(108,92,231,0.15), rgba(108,92,231,0.06));
  color: #d0c8ff;
  border: 1px solid rgba(108,92,231,0.12);
}
.chat-msg.admin {
  align-self: flex-start;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.chat-msg.user {
  border-bottom-right-radius: 4px;
}
.chat-msg.system {
  align-self: center;
  max-width: 90%;
  background: rgba(108,92,231,0.06);
  color: var(--accent-light);
  border: 1px solid rgba(108,92,231,0.1);
  font-size: 12px;
  padding: 8px 14px;
  text-align: center;
  border-radius: 20px;
}
/* AI avatar for admin messages */
.chat-msg.admin::before {
  content: 'AI';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: -0.3px;
  position: absolute;
  top: -8px;
  left: -4px;
  box-shadow: 0 2px 8px rgba(108,92,231,0.3);
}
.chat-msg.admin {
  position: relative;
  margin-left: 8px;
}
.chat-msg .time {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 6px;
  opacity: 0.7;
}
.chat-msg pre {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
}
.chat-msg code {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 12px;
}
.chat-msg pre code { background: none; padding: 0; }
.chat-msg :not(pre) > code {
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 4px;
}
.chat-msg b { color: var(--cyan); font-weight: 600; }
.chat-msg a { color: #74b9ff; text-decoration: underline; word-break: break-all; }
.chat-msg a:hover { color: #a29bfe; }
.chat-msg p { margin: 6px 0; }
.chat-msg .msg-paragraph + .msg-paragraph { margin-top: 10px; }
/* Scroll to bottom button */
.chat-scroll-btn {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 4px 16px rgba(108,92,231,0.4);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  opacity: 0;
}
.chat-scroll-btn.show {
  transform: translateX(-50%) scale(1);
  opacity: 1;
}
.chat-scroll-btn:hover {
  background: var(--accent-light);
  box-shadow: 0 6px 24px rgba(108,92,231,0.5);
}
/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 14px;
  align-self: flex-start;
}
.typing-indicator .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-light);
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}
/* Message timestamp hover reveal */
.chat-msg .time {
  transition: opacity 0.2s;
}

.code-block-wrap { position: relative; margin: 8px 0; }
.code-block-wrap .copy-btn {
  position: absolute; top: 6px; right: 6px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  color: #aaa; font-size: 11px; padding: 3px 10px;
  border-radius: 4px; cursor: pointer; z-index: 2;
  transition: all 0.2s;
}
.code-block-wrap .copy-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
.code-block-wrap .copy-btn.copied { background: rgba(0,210,106,0.2); color: #00d26a; border-color: rgba(0,210,106,0.3); }
.code-block-wrap .code-lang {
  position: absolute; top: 6px; left: 10px;
  font-size: 10px; color: #888; text-transform: uppercase;
}
.code-block-wrap pre { margin: 0; padding-top: 28px; }
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent, #6c5ce7);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink-cursor 0.6s step-end infinite;
}
@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Quick actions toolbar */
.chat-quick-actions {
  display: none;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  gap: 6px;
  flex-wrap: wrap;
}
.chat-quick-actions.show { display: flex; }
.quick-btn {
  background: rgba(108,92,231,0.08);
  border: 1px solid rgba(108,92,231,0.15);
  color: var(--text-dim);
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.quick-btn:hover {
  background: rgba(108,92,231,0.18);
  color: #fff;
  border-color: var(--accent);
}
/* Chat input area */
.chat-input-area {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-input-wrap {
  flex: 1;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}
.chat-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(108,92,231,0.08);
}
.chat-input-wrap textarea {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 14px 4px;
  color: var(--text);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  resize: none;
  min-height: 20px;
  max-height: 150px;
  line-height: 1.5;
}
.chat-input-tools {
  display: flex;
  gap: 2px;
  padding: 2px 8px 6px;
}
.input-tool-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1;
}
.input-tool-btn:hover {
  background: rgba(108,92,231,0.12);
  color: var(--accent-light);
}
.chat-send-btn {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  flex-shrink: 0;
}
.chat-send-btn:hover {
  box-shadow: 0 4px 20px rgba(108,92,231,0.3);
}
.chat-send-btn:active {
  transform: scale(0.94);
}
.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.chat-attachment-preview {
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  flex-wrap: wrap;
}
.attach-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(108,92,231,0.1);
  border: 1px solid rgba(108,92,231,0.2);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--accent-light);
}
.attach-tag .remove-attach {
  cursor: pointer;
  opacity: 0.6;
  font-size: 13px;
}
.attach-tag .remove-attach:hover { opacity: 1; }

/* Processing indicator */
.processing-bar {
  display: none;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: rgba(108,92,231,0.03);
}
.processing-bar.show { display: block; }
.processing-bar .label {
  font-size: 13px;
  color: var(--accent-light);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.processing-bar .label .spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-bar .bar-track {
  height: 2px;
  background: rgba(255,255,255,0.04);
  border-radius: 2px;
  overflow: hidden;
}
.processing-bar .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan), var(--accent));
  background-size: 200% 100%;
  border-radius: 2px;
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Drop zone */
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(108,92,231,0.08);
  border: 3px dashed var(--accent);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent-light);
  font-weight: 700;
  backdrop-filter: blur(4px);
}
.drop-overlay.show { display: flex; }

/* Preview Panel */
.preview-panel {
  display: none;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: #fff;
  min-width: 0;
  position: relative;
}
/* Preview watermark overlay for trial users */
.preview-watermark {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  font-weight: 900;
  color: rgba(108,92,231,0.12);
  pointer-events: none;
  z-index: 5;
  letter-spacing: 8px;
  text-transform: uppercase;
  transform: rotate(-30deg);
  user-select: none;
}
.preview-panel.open { display: flex; width: 50%; flex-shrink: 0; flex-grow: 0; }
.preview-header {
  height: 38px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  flex-shrink: 0;
}
.preview-header .url-bar {
  flex: 1;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--text-dim);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
}
.preview-header .url-bar:focus { border-color: var(--accent); }
.preview-header button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.2s;
}
.preview-header button:hover { background: var(--hover); color: var(--text-bright); }
.preview-iframe { flex: 1; border: none; background: #fff; width: 100%; }
.editor-area.with-preview { flex: 1; min-width: 300px; }

/* Welcome tips in chat */
.welcome-tips {
  background: linear-gradient(135deg, rgba(108,92,231,0.06), rgba(0,210,255,0.04));
  border: 1px solid rgba(108,92,231,0.1);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 12px 8px;
}
.welcome-tips .tips-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 14px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.welcome-tips .tip-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.welcome-tips .tip-item:last-child { margin-bottom: 0; }
.welcome-tips .tip-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.welcome-tips .tip-item b { color: var(--text-bright); }
.welcome-tips .tips-templates {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(108,92,231,0.1);
}
.welcome-tips .tips-label {
  font-size: 12px;
  color: var(--accent-light);
  font-weight: 600;
  margin-bottom: 10px;
}
.welcome-tips .template-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.welcome-tips .template-btn {
  background: rgba(108,92,231,0.08);
  border: 1px solid rgba(108,92,231,0.18);
  color: var(--text);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.welcome-tips .template-btn:hover {
  background: rgba(108,92,231,0.2);
  border-color: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

/* ---- HOW IT WORKS STEPS ---- */
.steps-section {
  min-height: auto;
  padding: 80px 24px;
}
.steps-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 700px;
  width: 100%;
  position: relative;
}
.steps-grid::before {
  content: '';
  position: absolute;
  left: 28px;
  top: 40px;
  bottom: 40px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--cyan), var(--green));
  opacity: 0.3;
}
.step-item {
  display: flex;
  gap: 24px;
  padding: 28px 0;
  position: relative;
}
.step-num {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  font-family: 'JetBrains Mono', monospace;
}
.step-item:nth-child(1) .step-num { background: rgba(108,92,231,0.15); color: var(--accent-light); border: 2px solid rgba(108,92,231,0.3); }
.step-item:nth-child(2) .step-num { background: rgba(0,210,255,0.12); color: var(--cyan); border: 2px solid rgba(0,210,255,0.25); }
.step-item:nth-child(3) .step-num { background: rgba(0,245,160,0.12); color: var(--green); border: 2px solid rgba(0,245,160,0.25); }
.step-item:nth-child(4) .step-num { background: rgba(253,121,168,0.12); color: var(--pink); border: 2px solid rgba(253,121,168,0.25); }
.step-item:nth-child(5) .step-num { background: rgba(255,217,61,0.12); color: var(--yellow); border: 2px solid rgba(255,217,61,0.25); }
.step-item:nth-child(6) .step-num { background: rgba(108,92,231,0.15); color: var(--accent-light); border: 2px solid rgba(108,92,231,0.3); }
.step-content {
  flex: 1;
  padding-top: 4px;
}
.step-content h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-white);
  margin-bottom: 8px;
}
.step-content p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
}
.step-content .step-tip {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  line-height: 1.6;
}
.step-content .step-tip b { color: var(--accent-light); }
.free-trial-banner {
  margin-top: 40px;
  text-align: center;
  background: linear-gradient(135deg, rgba(108,92,231,0.08), rgba(0,210,255,0.06));
  border: 1px solid rgba(108,92,231,0.15);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
}
.free-trial-banner h3 {
  font-size: 20px;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.free-trial-banner p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}
.free-trial-banner .trial-highlight {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  background: rgba(0,245,160,0.08);
  border: 1px solid rgba(0,245,160,0.15);
  border-radius: 100px;
  padding: 6px 20px;
}

/* Mobile */
.mobile-menu-btn { display: none !important; }
.mobile-bottom-bar { display: none; }

/* ============ Tablet (768px) ============ */
@media (max-width: 768px) {
  /* ---- Welcome / Landing ---- */
  .welcome-section { padding: 40px 16px; min-height: auto; }
  .hero { padding: 0 4px; }
  .hero-badge { font-size: 10px; padding: 5px 12px; margin-bottom: 20px; }
  .hero-logo { font-size: 42px; letter-spacing: 4px; }
  .hero-tagline { font-size: 13px; letter-spacing: 1.5px; margin-bottom: 16px; }
  .hero-desc { font-size: 14px; margin-bottom: 28px; }
  .stats-bar { gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
  .stat-num { font-size: 20px; }
  .stat-label { font-size: 10px; }
  .mcp-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 28px; }
  .mcp-card { padding: 12px 8px; }
  .mcp-card .mcp-icon { width: 28px; height: 28px; font-size: 14px; margin-bottom: 6px; }
  .mcp-card .mcp-label { font-size: 10px; }
  .auth-container { max-width: 100%; }
  .auth-box { padding: 20px 16px; border-radius: var(--radius-md); }
  .auth-tabs { margin-bottom: 20px; }
  .auth-tab { padding: 9px 6px; font-size: 13px; }
  .auth-form input { padding: 12px 14px; font-size: 16px; }
  .auth-form .btn { padding: 13px; font-size: 14px; min-height: 48px; }
  #verifyCode { font-size: 18px !important; letter-spacing: 6px !important; }
  .powered-section { margin-top: 20px; }
  .tech-stack { gap: 8px; flex-wrap: wrap; justify-content: center; }
  .mcp-showcase { padding: 40px 16px; }
  .section-badge { font-size: 10px; }
  .section-title { font-size: 22px; }
  .section-desc { font-size: 14px; }
  .mcp-features { grid-template-columns: 1fr; gap: 12px; }
  .mcp-feature { padding: 20px 16px; }
  .mcp-feature .feat-title { font-size: 14px; }
  .mcp-feature .feat-desc { font-size: 12px; }

  /* Steps */
  .steps-section { padding: 40px 16px; }
  .steps-grid::before { left: 24px; }
  .step-item { gap: 16px; padding: 20px 0; }
  .step-num { width: 48px; height: 48px; font-size: 18px; }
  .step-content h3 { font-size: 16px; }
  .step-content p { font-size: 13px; }
  .free-trial-banner { padding: 20px 16px; }
  .free-trial-banner h3 { font-size: 18px; }

  /* ---- IDE Layout ---- */
  .titlebar { padding: 0 8px; height: 44px; }
  .titlebar .left { gap: 4px; }
  .titlebar .title { font-size: 11px; letter-spacing: 1px; }
  .titlebar .uid { font-size: 9px; padding: 2px 5px; max-width: 60px; overflow: hidden; text-overflow: ellipsis; }
  .titlebar .mcp-status { display: none; }
  .titlebar .right-btns { gap: 4px; }
  .titlebar .tb-btn { padding: 5px 8px; font-size: 10px; }
  .mobile-menu-btn { display: inline-block !important; font-size: 16px; }
  .titlebar .preview-btn,
  .titlebar .chat-btn { display: none !important; }
  .titlebar .subscribe-btn .sub-text { display: none; }
  .titlebar .subscribe-btn { padding: 5px 10px; font-size: 16px; }

  .main-body { flex-direction: column; }
  .resizer { display: none !important; }
  .sidebar {
    width: 100% !important; height: auto; max-height: 0; overflow: hidden;
    border-right: none; border-bottom: 1px solid var(--border);
    transition: max-height 0.3s ease;
  }
  .sidebar.mobile-open { max-height: 50vh; overflow-y: auto; }
  .mcp-tools-panel { padding: 8px 12px; }
  .mcp-tool-list { gap: 3px; }
  .mcp-tool-tag { font-size: 9px; padding: 2px 6px; }
  .sidebar-header { padding: 8px 12px; font-size: 10px; }

  .editor-area { flex: 1; min-width: 0; }
  .editor-area.with-preview { min-width: 0; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 7px 12px; font-size: 11px; white-space: nowrap; }
  .editor-content textarea { font-size: 13px; padding: 10px 12px; }
  .statusbar { padding: 0 8px; font-size: 10px; height: 24px; }

  /* Preview full-screen on mobile */
  .preview-panel.open {
    position: fixed; top: 44px; left: 0; right: 0; bottom: 0;
    width: 100% !important; z-index: 100; background: var(--bg);
  }
  .preview-header { padding: 0 8px; height: 34px; }
  .preview-header .url-bar { font-size: 11px; padding: 4px 8px; }

  /* ---- Chat full-screen on mobile ---- */
  .chat-overlay {
    width: 100% !important;
    top: 44px !important;
    border-left: none;
  }
  .chat-header { padding: 10px 12px; }
  .chat-header .chat-title { font-size: 14px; }
  /* Mode toggle — bigger touch targets on mobile */
  .mode-toggle { gap: 8px; }
  .mode-toggle .mode-btn {
    padding: 12px 14px;
    gap: 8px;
    border-radius: 12px;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
  }
  .mode-toggle .mode-btn .mode-icon { font-size: 20px; }
  .mode-toggle .mode-btn .mode-label { font-size: 14px; font-weight: 700; }
  .mode-toggle .mode-btn .mode-desc { display: none; }
  .chat-header .close-btn { padding: 8px 12px; font-size: 22px; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }

  /* Chat messages — more space, better touch */
  .chat-messages { padding: 12px 10px; gap: 10px; }
  .chat-msg {
    max-width: 88%;
    padding: 10px 14px;
    font-size: 13px;
    border-radius: 14px;
    -webkit-user-select: text;
    user-select: text;
  }
  .chat-msg.admin::before { width: 18px; height: 18px; font-size: 7px; top: -6px; left: -2px; }
  .chat-msg pre { font-size: 11px; padding: 8px 10px; }
  .chat-msg pre code { font-size: 11px; }
  .code-block-wrap pre { padding-top: 26px; }
  .code-block-wrap .copy-btn { font-size: 10px; padding: 4px 8px; }
  .code-block-wrap .code-lang { font-size: 9px; }

  /* Chat input — full width on mobile, send btn inside */
  .chat-input-area {
    padding: 8px 8px calc(env(safe-area-inset-bottom, 0px) + 8px);
    gap: 0;
    flex-direction: column;
    position: relative;
  }
  .chat-input-wrap {
    width: 100%;
    border-radius: 14px;
    position: relative;
  }
  .chat-input-wrap textarea {
    padding: 14px 70px 14px 16px;
    font-size: 16px;
    min-height: 52px;
    max-height: 140px;
    line-height: 1.5;
    width: 100%;
  }
  .chat-send-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 10px;
    min-height: 40px;
    min-width: 40px;
    letter-spacing: 0.5px;
    z-index: 2;
  }
  .chat-input-tools {
    padding: 4px 8px 8px;
  }
  .chat-input-tools .input-tool-btn {
    font-size: 20px;
    padding: 6px 10px;
    min-height: 40px;
    min-width: 40px;
    -webkit-tap-highlight-color: transparent;
  }
  /* Agent label on mobile */
  .chat-input-area.agent-mode .agent-label {
    font-size: 12px;
    padding: 6px 14px;
  }

  /* Quick actions — horizontal scroll on mobile */
  .chat-quick-actions {
    padding: 8px 10px;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .chat-quick-actions::-webkit-scrollbar { display: none; }
  .quick-btn {
    font-size: 12px;
    padding: 7px 14px;
    flex-shrink: 0;
    min-height: 36px;
  }

  /* Processing bar */
  .processing-bar { padding: 10px 12px; }
  .processing-bar .label { font-size: 12px; }

  /* Agent steps compact */
  .agent-steps { padding: 10px 12px; max-width: 90%; }
  .agent-step { font-size: 12px; padding: 5px 0; }

  /* Welcome tips mobile */
  .welcome-tips { padding: 14px; margin: 8px 4px; }
  .welcome-tips .tips-title { font-size: 13px; margin-bottom: 10px; }
  .welcome-tips .tip-item { font-size: 12px; gap: 8px; }
  .welcome-tips .tip-icon { font-size: 14px; }
  .welcome-tips .template-btns {
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .welcome-tips .template-btns::-webkit-scrollbar { display: none; }
  .welcome-tips .template-btn {
    font-size: 12px;
    padding: 8px 14px;
    min-height: 36px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  /* Scroll to bottom button position */
  .chat-scroll-btn { bottom: 70px; }

  /* Mobile bottom bar */
  .mobile-bottom-bar {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(50px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(9,9,26,0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-light);
    z-index: 150;
    align-items: center;
    justify-content: space-around;
    padding-left: 8px;
    padding-right: 8px;
  }
  .mobile-bottom-bar .mob-btn {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px;
    background: none; border: none;
    color: var(--text-dim);
    font-size: 18px;
    padding: 6px 12px;
    cursor: pointer;
    transition: color 0.2s;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
    min-width: 48px;
    min-height: 44px;
  }
  .mobile-bottom-bar .mob-btn span { font-size: 9px; font-weight: 600; letter-spacing: 0.3px; }
  .mobile-bottom-bar .mob-btn.active { color: var(--accent-light); }

  /* Adjust IDE for bottom bar */
  .ide { padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px)); }
  .chat-overlay { bottom: calc(50px + env(safe-area-inset-bottom, 0px)) !important; }
  .preview-panel.open { bottom: calc(50px + env(safe-area-inset-bottom, 0px)); }

  /* System messages compact */
  .chat-msg.system { font-size: 11px; padding: 6px 12px; }
}

/* ============ Extra small (380px) ============ */
@media (max-width: 380px) {
  .hero-logo { font-size: 36px; letter-spacing: 3px; }
  .hero-tagline { font-size: 12px; }
  .stats-bar { gap: 12px; }
  .stat-num { font-size: 18px; }
  .mcp-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-box { padding: 16px 12px; }
  .titlebar .uid { display: none; }
  .chat-msg { max-width: 92%; font-size: 13px; }
  .chat-msg pre { font-size: 10px; }
  .mode-toggle .mode-btn { padding: 10px 12px; min-height: 44px; }
  .mode-toggle .mode-btn .mode-label { font-size: 13px; }
  .chat-send-btn { padding: 8px 14px; font-size: 13px; min-height: 36px; min-width: 36px; right: 6px; bottom: 6px; }
  .chat-input-wrap textarea { min-height: 48px; font-size: 16px; padding-right: 62px; }
  .quick-btn { font-size: 11px; padding: 6px 10px; min-height: 34px; }
}

/* Mobile: hide language switcher when IDE is active */
@media (max-width: 768px) {
  body.ide-active #langSwitcher { display: none !important; }
}

/* ========== Subscription Popup Modal ========== */
.subscribe-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.4s ease;
}
.subscribe-popup-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.subscribe-popup {
  background: linear-gradient(145deg, #0e0e1e, #141428);
  border: 1px solid rgba(108,92,231,0.3);
  border-radius: 20px;
  padding: 40px 36px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(108,92,231,0.2), 0 0 120px rgba(108,92,231,0.08);
  transform: scale(0.85) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.subscribe-popup-overlay.show .subscribe-popup {
  transform: scale(1) translateY(0);
}
.subscribe-popup .popup-icon {
  font-size: 56px;
  margin-bottom: 16px;
  display: block;
  animation: pop-bounce 0.6s ease 0.3s both;
}
@keyframes pop-bounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.subscribe-popup .popup-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}
.subscribe-popup .popup-desc {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 24px;
}
.subscribe-popup .popup-features {
  text-align: left;
  margin-bottom: 24px;
}
.subscribe-popup .popup-feat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-bright);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.subscribe-popup .popup-feat-item:last-child { border-bottom: none; }
.subscribe-popup .popup-feat-item .feat-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
}
.subscribe-popup .popup-btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.subscribe-popup .popup-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(108,92,231,0.4);
}
.subscribe-popup .popup-btn-secondary {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  padding: 8px;
}
.subscribe-popup .popup-btn-secondary:hover {
  color: var(--text);
}

/* ============ Markdown rendering styles ============ */
.md-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #dfe6e9;
  margin: 14px 0 6px 0;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  letter-spacing: 0.3px;
}
.md-section-title:first-child {
  margin-top: 0;
}
.md-check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0;
  padding: 3px 0;
  line-height: 1.5;
}
.md-check {
  color: #00d26a;
  font-weight: bold;
  flex-shrink: 0;
  margin-top: 1px;
}
.md-list-item {
  margin: 3px 0;
  padding: 2px 0 2px 4px;
  line-height: 1.5;
}
.md-num {
  color: #74b9ff;
  font-weight: 700;
  margin-right: 2px;
}
.md-image-wrap {
  margin: 10px 0;
  text-align: center;
}
.md-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: transform 0.2s;
}
.md-image:hover {
  transform: scale(1.02);
  border-color: var(--accent);
}
.md-image-caption {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}
@media (max-width: 480px) {
  .subscribe-popup {
    padding: 28px 20px;
    border-radius: 16px;
  }
  .subscribe-popup .popup-icon { font-size: 44px; }
  .subscribe-popup .popup-title { font-size: 18px; }
}
