/* ============ AI 剧本工坊 · 公共样式 ============ */
:root {
  --bg-base: #0E0B1F;
  --bg-elevated: #16112E;
  --bg-elevated-2: #1F1840;
  --bg-elevated-3: #2A2155;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text-primary: #F5F3FF;
  --text-secondary: #C4BFE0;
  --text-muted: #8B83B8;
  --indigo: #6366F1;
  --indigo-soft: #818CF8;
  --indigo-deep: #4F46E5;
  --gold: #F59E0B;
  --gold-soft: #FBBF24;
  --green: #22C55E;
  --green-soft: #4ADE80;
  --rose: #F43F5E;
  --rose-soft: #FB7185;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.45);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Source Han Sans SC', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(245, 158, 11, 0.1), transparent 60%),
    var(--bg-base);
}

/* 强调字体（标题） */
.font-serif-en,
h1, h2, h3, .heading-serif {
  font-family: 'Playfair Display', 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', serif;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

/* ===== 顶部导航 ===== */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  background: rgba(14, 11, 31, 0.72);
  border-bottom: 1px solid var(--border);
}

.app-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.app-brand-text {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-brand-text small {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-left: 6px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

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

.nav-links a.active {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.18);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.3);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.icon-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--rose);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366F1, #F59E0B);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
  font-family: 'Inter', sans-serif;
}

/* ===== 通用按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: var(--indigo);
  color: white;
}

.btn-primary:hover {
  background: var(--indigo-deep);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.btn-cta {
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
  color: #0E0B1F;
}

.btn-cta:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3);
}

.btn-success {
  background: var(--green);
  color: #0a2516;
}

.btn-success:hover {
  background: var(--green-soft);
}

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

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 15px;
  border-radius: 14px;
}

/* ===== 卡片与玻璃 ===== */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s, transform 0.2s;
}

.card-hover:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.glass {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

/* ===== 标签芯片 ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}

.chip-indigo {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.3);
  color: #C7D2FE;
}

.chip-gold {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.3);
  color: #FCD34D;
}

.chip-rose {
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(244, 63, 94, 0.3);
  color: #FDA4AF;
}

.chip-green {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.3);
  color: #86EFAC;
}

/* ===== 容器 ===== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== 章节标题 ===== */
.section-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: 12px;
}

.section-title {
  font-family: 'Playfair Display', 'Noto Serif SC', serif;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.section-sub {
  color: var(--text-secondary);
  font-size: 15px;
  margin: 0;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  border: 2px solid var(--bg-base);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ===== 通用工具类 ===== */
.text-muted {
  color: var(--text-muted);
}

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

.text-gold {
  color: var(--gold-soft);
}

.text-indigo {
  color: var(--indigo-soft);
}

.text-green {
  color: var(--green-soft);
}

.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 24px 0;
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 18, 0.74);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-mask.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.2s;
}

.modal-mask.show .modal-card {
  transform: translateY(0) scale(1);
}

.modal-title {
  font-family: 'Playfair Display', 'Noto Serif SC', serif;
  font-size: 22px;
  margin: 0 0 8px;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
}

/* ===== 输入框 ===== */
.input,
.textarea,
.select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s, background 0.2s;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--indigo-soft);
  background: rgba(99, 102, 241, 0.06);
}

.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}

label.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

/* ===== 动画 ===== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  animation: fadeUp 0.5s cubic-bezier(0.21, 1, 0.32, 1) backwards;
}

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

.dot-pulse {
  animation: pulse 1.4s infinite;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .app-nav-inner {
    padding: 12px 16px;
  }

  .container,
  .container-narrow {
    padding: 0 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
