:root {
  --bg-primary: #030014;
  --bg-card: rgba(255, 255, 255, 0.02);
  --bg-card-hover: rgba(255, 255, 255, 0.04);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-muted: rgba(255, 255, 255, 0.45);
  --accent-blue: #2EA7FF;
  --accent-cyan: #13DDC4;
  --accent-purple: #9381FF;
  --accent-amber: #FFB454;
  --accent-pink: #FF4D6D;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

.app-container {
  min-height: 100vh;
  position: relative;
}

/* Aurora Background */
.aurora-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(46, 167, 255, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(147, 129, 255, 0.12) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 80%, rgba(19, 221, 196, 0.08) 0%, transparent 40%),
    var(--bg-primary);
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(40px);
  box-shadow: var(--shadow-elevated);
}

.glass-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
  width: 100%;
}

.glass-input:focus {
  border-color: var(--accent-blue);
  background: rgba(46, 167, 255, 0.06);
}

.glass-input::placeholder {
  color: var(--text-muted);
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background: #4ab5ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(46, 167, 255, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.tag {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 500;
}

.tag-blue {
  background: rgba(46, 167, 255, 0.15);
  color: var(--accent-blue);
}

.tag-pink {
  background: rgba(255, 77, 109, 0.15);
  color: var(--accent-pink);
}

.tag-neutral {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  font-size: 18px;
  font-weight: 700;
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-blue);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  font-size: 14px;
}

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

.nav-item.active {
  background: rgba(46, 167, 255, 0.15);
  color: var(--accent-blue);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.main-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}

.header {
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.content-area {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.page-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  height: 100%;
}

.page-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
}

@media (max-width: 1200px) {
  .page-grid {
    grid-template-columns: 1fr;
  }
  .page-grid-3 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.option-group {
  margin-bottom: 16px;
}

.option-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-weight: 500;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.option.active {
  background: rgba(46, 167, 255, 0.15);
  color: var(--accent-blue);
  border-color: rgba(46, 167, 255, 0.3);
}

.editor-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  width: 100%;
  outline: none;
}

.editor-content {
  width: 100%;
  min-height: 400px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.8;
  outline: none;
  resize: none;
  font-family: inherit;
}

.ai-tip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

.ai-tip-label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.ai-tip-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.quick-action {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  color: var(--text-secondary);
}

.quick-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.character-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.character-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

.character-card.active {
  border-color: rgba(46, 167, 255, 0.3);
  background: rgba(46, 167, 255, 0.08);
}

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

.template-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.template-item {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  color: var(--text-secondary);
}

.template-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.template-item svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 768px) {
  .sidebar {
    width: 200px;
    padding: 16px 12px;
  }
  .template-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Login page specific */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px;
}

.login-content {
  display: flex;
  align-items: center;
  gap: 80px;
  max-width: 1200px;
  width: 100%;
}

.login-brand {
  flex: 1;
  max-width: 520px;
}

.login-title {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.2;
  margin: 24px 0;
}

.login-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 15px;
}

.feature-icon {
  width: 20px;
  height: 20px;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.login-card {
  width: 420px;
  padding: 40px;
}

.login-card-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-card-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.input-group {
  margin-bottom: 16px;
}

.input-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.input-row .glass-input {
  flex: 1;
}

.code-btn {
  white-space: nowrap;
  padding: 12px 16px;
  background: rgba(46, 167, 255, 0.15);
  color: var(--accent-blue);
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}

.login-btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  font-size: 16px;
}

.login-agreement {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 16px;
}

.login-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.login-stat {
  text-align: center;
}

.login-stat-num {
  font-size: 22px;
  font-weight: 700;
}

.login-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

@media (max-width: 900px) {
  .login-content {
    flex-direction: column;
    gap: 40px;
  }
  .login-brand {
    text-align: center;
  }
  .login-title {
    font-size: 36px;
  }
  .login-card {
    width: 100%;
    max-width: 420px;
  }
}

/* Utility */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.text-sm { font-size: 14px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.scrollable {
  overflow-y: auto;
}

.scrollable::-webkit-scrollbar {
  width: 6px;
}

.scrollable::-webkit-scrollbar-track {
  background: transparent;
}

.scrollable::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* Section tree */
.tree-node {
  padding: 14px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  border: 1px solid var(--border-subtle);
}

.tree-node-main {
  background: rgba(147, 129, 255, 0.12);
  border-color: rgba(147, 129, 255, 0.2);
}

.tree-node-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.tree-node-title-main {
  color: var(--accent-purple);
}

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

.add-node-btn {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-node-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* Stats */
.stat-item {
  text-align: center;
}

.stat-num {
  font-size: 24px;
  font-weight: 700;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Word count badge */
.word-count {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 50px;
  font-size: 13px;
  color: var(--accent-cyan);
  font-weight: 500;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(46, 167, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-blue);
}

/* Breadcrumb */
.breadcrumb {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Outline item in editor */
.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chapter-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.chapter-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.chapter-item.active {
  background: rgba(46, 167, 255, 0.1);
  color: var(--accent-blue);
  font-weight: 500;
}

/* Section titles */
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  text-align: center;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Loading */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 0, 20, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(46, 167, 255, 0.2);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.hidden {
  display: none !important;
}
