:root {
  --bg-color: #fafafa;
  --bg-sidebar: #ffffff;
  --bg-panel: #ffffff;
  --border-color: #e5e5e5;
  --text-primary: #121212;
  --text-secondary: #666666;
  --text-tertiary: #999999;
  --accent-color: #000000;
  --accent-hover: #333333;
  --message-bg-user: #f4f4f5;
  --message-bg-ai: transparent;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 50px rgba(0, 0, 0, 0.08);
  
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Menlo", "Consolas", monospace;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg-color: #0d0d0d;
  --bg-sidebar: #141414;
  --bg-panel: #141414;
  --border-color: #2a2a2a;
  --text-primary: #ededed;
  --text-secondary: #a0a0a0;
  --text-tertiary: #666666;
  --accent-color: #ffffff;
  --accent-hover: #e0e0e0;
  --message-bg-user: #222;
  --message-bg-ai: transparent;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 50px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), color 0.4s ease;
}

.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: 320px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 32px;
  transition: all 0.4s ease;
  z-index: 20;
}

.sidebar-header {
  margin-bottom: 48px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  background: var(--text-primary);
  color: var(--bg-sidebar);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-sm);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.4px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 40px;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  font-weight: 600;
  padding-left: 2px;
}

.strategy-card {
  background: var(--bg-color);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.strategy-card .quote {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}

.strategy-card .desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.quick-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-item {
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-item:hover {
  background: var(--bg-color);
  color: var(--text-primary);
  transform: translateX(4px);
}

.footer-group {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.model-info {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.skill-source {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-decoration: none;
  padding: 6px 0;
  transition: color 0.2s ease;
  margin-bottom: 4px;
}

.skill-source:hover {
  color: var(--text-primary);
}

.skill-source svg {
  flex-shrink: 0;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-color);
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 48px;
  background: rgba(var(--bg-color), 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 10;
  border-bottom: 1px solid transparent;
}

[data-theme="dark"] .chat-header {
  background: rgba(13, 13, 13, 0.8);
}

.header-info h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.header-info p {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  background: var(--bg-panel);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  border-color: var(--text-tertiary);
}

/* Messages container */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 48px 40px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  scroll-behavior: smooth;
}

.welcome-view {
  max-width: 800px;
  margin: 80px auto;
  animation: fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(10px);
}

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

.welcome-content h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.8px;
  margin-bottom: 60px;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.3;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.step {
  padding: 32px 28px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.step:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--text-tertiary);
}

.step-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  display: block;
}

.step h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.step p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Chat Message Layout */
.chat-message {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  animation: fade-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.message-role {
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.copy-button {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
}

.chat-message:hover .copy-button {
  opacity: 1;
}

.copy-button:hover {
  color: var(--text-primary);
}

.message-content {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.7;
  word-break: break-word;
  padding: 16px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
}

.chat-message.user .message-content {
  background: var(--message-bg-user);
  border-color: transparent;
  box-shadow: none;
  color: var(--text-primary);
}

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

.chat-message.user {
  align-items: flex-end;
}

.chat-message.user .message-content {
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
  border-bottom-left-radius: 4px;
}

/* Input Area */
.input-area {
  padding: 0 48px 48px;
  background: linear-gradient(to top, var(--bg-color) 85%, transparent);
  z-index: 10;
}

.input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.input-wrapper:focus-within {
  border-color: var(--text-tertiary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

textarea {
  width: 100%;
  background: transparent;
  border: none;
  padding: 24px 28px;
  font-size: 15px;
  color: var(--text-primary);
  resize: none;
  min-height: 72px;
  max-height: 240px;
  outline: none;
  font-family: inherit;
  line-height: 1.6;
}

textarea::placeholder {
  color: var(--text-tertiary);
}

.input-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
}

.input-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-stop {
  font-size: 13px;
  padding: 8px 14px;
}

.btn-stop:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.usage-text {
  font-size: 12px;
  color: var(--text-tertiary);
  flex: 1;
  text-align: center;
  padding: 0 12px;
}

.char-count {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  padding-left: 8px;
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--text-primary);
  color: var(--bg-panel);
  border: none;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: scale(1.02);
}

.btn-primary svg {
  fill: currentColor;
}

.markdown-body p { margin-bottom: 1.2em; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body strong { font-weight: 600; }
.markdown-body em { font-style: italic; color: var(--text-secondary); }

/* Scrollbar tweaks */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

@media (max-width: 860px) {
  .sidebar { position: absolute; transform: translateX(-100%); z-index: 30; height: 100%; box-shadow: var(--shadow-lg); width: 280px; }
  .chat-header { padding: 20px 24px; }
  .messages-container { padding: 24px; gap: 24px; }
  .input-area { padding: 0 24px 24px; }
  .steps-grid { grid-template-columns: 1fr; gap: 16px; }
  .welcome-view { margin-top: 40px; }
}
