/* ============================================
   AI春联生成器 - 传统春节主题
   红红火火 · 金玉满堂 · 喜气洋洋
   ============================================ */

/* CSS Variables - 春节传统色彩 */
:root {
  /* 中国红系列 - 正红到深红 */
  --china-red: #C41E3A;
  --china-red-light: #DC143C;
  --china-red-dark: #8B0000;
  --china-red-deep: #660000;
  
  /* 金色系列 - 富贵荣华 */
  --gold: #FFD700;
  --gold-light: #FFEC8B;
  --gold-dark: #D4AF37;
  --gold-deep: #B8860B;
  
  /* 传统色彩点缀 */
  --cinnabar: #E34234;
  --coral: #FF6B6B;
  --amber: #FFBF00;
  
  /* 宣纸与墨色 */
  --rice-paper: #FDF5E6;
  --rice-paper-warm: #FAF0E6;
  --rice-paper-aged: #F5E6D3;
  --ink-black: #1a1a1a;
  --ink-gray: #4a4a4a;
  --ink-light: #8B7355;
  
  /* 字体 */
  --font-calligraphy: 'Ma Shan Zheng', 'STXingkai', 'KaiTi', cursive;
  --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'SimSun', serif;
  --font-sans: 'Noto Sans SC', 'Source Han Sans SC', 'Microsoft YaHei', sans-serif;
  
  /* 间距系统 */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  
  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* 阴影 */
  --shadow-red: 0 4px 20px rgba(196, 30, 58, 0.3);
  --shadow-gold: 0 0 30px rgba(255, 215, 0, 0.2);
  --shadow-card: 0 8px 32px rgba(139, 0, 0, 0.15);
}

/* ============================================
   基础重置 & 全局样式
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-serif);
  background: 
    /* 顶部金色光晕 */
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 215, 0, 0.2) 0%, transparent 60%),
    /* 底部深红光晕 */
    radial-gradient(ellipse 100% 60% at 50% 100%, rgba(102, 0, 0, 0.6) 0%, transparent 50%),
    /* 左侧微光 */
    radial-gradient(ellipse 40% 80% at 0% 50%, rgba(196, 30, 58, 0.15) 0%, transparent 50%),
    /* 右侧微光 */
    radial-gradient(ellipse 40% 80% at 100% 50%, rgba(196, 30, 58, 0.15) 0%, transparent 50%),
    /* 中心柔和过渡 */
    radial-gradient(ellipse 60% 40% at 50% 50%, rgba(139, 0, 0, 0.1) 0%, transparent 60%),
    /* 主背景渐变 - 多节点平滑过渡 */
    linear-gradient(180deg, 
      #4a0000 0%, 
      #660000 15%,
      #8B0000 35%,
      #A01830 55%,
      #C41E3A 75%,
      #DC143C 100%
    );
  min-height: 100vh;
  color: var(--ink-black);
  overflow-x: hidden;
  line-height: 1.6;
  position: relative;
  background-attachment: fixed;
}

/* 春节祥云纹理背景 - 更 subtle */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30,60 Q45,35 60,35 Q75,35 90,60 Q75,85 60,85 Q45,85 30,60' fill='none' stroke='%23FFD700' stroke-width='0.3' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

@keyframes bg-shimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* ============================================
   弹幕层 - 金色文字
   ============================================ */
.danmu-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  z-index: 99999;
  overflow: visible;
}

.danmu-item {
  position: absolute;
  white-space: nowrap;
  font-family: var(--font-calligraphy);
  font-size: 0.875rem;
  color: var(--gold);
  text-shadow: 
    0 0 10px rgba(255, 215, 0, 0.8),
    2px 2px 4px rgba(0, 0, 0, 0.5);
  animation: danmu-float linear forwards;
  pointer-events: auto;
  cursor: pointer;
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, rgba(196, 30, 58, 0.95) 0%, rgba(139, 0, 0, 0.98) 100%);
  border-radius: 100px;
  border: 1px solid var(--gold-dark);
  box-shadow: var(--shadow-gold);
}

.danmu-item:hover {
  background: linear-gradient(135deg, rgba(220, 38, 38, 1) 0%, rgba(180, 20, 20, 1) 100%);
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.5);
}

@keyframes danmu-float {
  from { transform: translateX(100vw); }
  to { transform: translateX(-100%); }
}

/* ============================================
   主容器
   ============================================ */
.main-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-8);
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* ============================================
   头部 - 春节喜庆风格
   ============================================ */
.header {
  text-align: center;
  padding: var(--space-4) 0 var(--space-5);
  position: relative;
  flex-shrink: 0;
}

/* 大灯笼装饰 */
.lantern {
  position: absolute;
  width: 48px;
  height: 64px;
  background: linear-gradient(180deg, var(--china-red) 0%, var(--china-red-dark) 100%);
  border-radius: 24px 24px 12px 12px;
  box-shadow:
    0 0 30px rgba(255, 215, 0, 0.4),
    inset 0 -8px 20px rgba(0, 0, 0, 0.3),
    0 5px 15px rgba(0, 0, 0, 0.3);
  animation: lantern-sway 3s ease-in-out infinite;
}

.lantern::before {
  content: '福';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-calligraphy);
  font-size: 1.5rem;
  color: var(--gold);
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
}

.lantern::after {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 16px;
  background: var(--gold);
  box-shadow:
    0 16px 0 var(--gold),
    -5px 18px 0 var(--gold),
    5px 18px 0 var(--gold),
    -10px 22px 0 var(--gold),
    0 22px 0 var(--gold),
    10px 22px 0 var(--gold);
}

.lantern.left { 
  left: 8%; 
  top: var(--space-2);
}

.lantern.right { 
  right: 8%; 
  top: var(--space-2);
  animation-delay: -1.5s;
}

@keyframes lantern-sway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

/* 标题样式 - 金色大字 */
.title {
  font-family: var(--font-calligraphy);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  color: var(--gold);
  text-shadow: 
    0 0 20px rgba(255, 215, 0, 0.5),
    3px 3px 6px rgba(0, 0, 0, 0.4);
  margin-bottom: var(--space-2);
  letter-spacing: 0.2em;
  position: relative;
  display: inline-block;
  animation: title-glow 2s ease-in-out infinite;
}

@keyframes title-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 3px 3px 6px rgba(0, 0, 0, 0.4); }
  50% { text-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 3px 3px 6px rgba(0, 0, 0, 0.4); }
}

.title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  border-radius: 2px;
}

.subtitle {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.3em;
  margin-top: var(--space-4);
  font-weight: 400;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* ============================================
   内容区布局 - 左中右三栏
   ============================================ */
.content {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-5);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 1200px) {
  .content {
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-4);
  }
}

@media (max-width: 1024px) {
  .content {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: var(--space-4);
    overflow-y: auto;
  }
  
  .history-section {
    grid-column: 1 / -1;
    order: 3;
  }
  
  .history-section .paper-effect {
    max-height: 160px;
    min-height: auto;
  }
  
  .history-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    flex: none;
  }
  
  .history-item {
    flex: 0 0 240px;
  }
}

/* ============================================
   宣纸卡片效果 - 春节卷轴风格
   ============================================ */
.paper-effect {
  background: rgba(253, 245, 230, 0.95);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(212, 175, 55, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
  height: 100%;
  max-height: calc(100vh - 200px);
  display: flex;
  flex-direction: column;
}

/* 卷轴装饰边框 - 更 subtle */
.paper-effect::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border: 1px solid rgba(196, 30, 58, 0.08);
  border-radius: calc(var(--radius-lg) - 4px);
  pointer-events: none;
}

/* 宣纸纹理 - 更淡 */
.paper-effect::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 6px,
      rgba(139, 69, 19, 0.015) 6px,
      rgba(139, 69, 19, 0.015) 12px
    );
  pointer-events: none;
  border-radius: inherit;
}

.history-section,
.config-section,
.result-section {
  height: 100%;
  min-height: 0;
}

/* 章节标题 - 传统风格 */
.section-title {
  font-family: var(--font-calligraphy);
  font-size: 1.5rem;
  color: var(--china-red);
  text-align: center;
  margin-bottom: var(--space-4);
  position: relative;
  padding-bottom: var(--space-3);
  flex-shrink: 0;
  letter-spacing: 0.15em;
}

.section-title::before,
.section-title::after {
  content: '❖';
  position: absolute;
  top: 4px;
  color: var(--gold-dark);
  font-size: 0.625rem;
}

.section-title::before { left: 15%; }
.section-title::after { right: 15%; }

.section-title {
  border-bottom: 2px solid transparent;
  background: linear-gradient(90deg, transparent, var(--china-red), transparent) bottom/60% 2px no-repeat;
}

/* ============================================
   表单样式
   ============================================ */
.form-group {
  margin-bottom: var(--space-3);
  position: relative;
  z-index: 1;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

label {
  display: block;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ink-gray);
  margin-bottom: var(--space-1);
}

/* 输入框样式 - 传统边框 */
input[type="text"],
select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid var(--rice-paper-aged);
  border-radius: var(--radius-md);
  font-family: var(--font-serif);
  font-size: 0.9375rem;
  color: var(--ink-black);
  transition: all 0.2s ease;
  outline: none;
  height: 40px;
}

input[type="text"]::placeholder {
  color: var(--ink-light);
  opacity: 0.7;
}

input[type="text"]:hover,
select:hover {
  border-color: var(--coral);
  background: white;
}

input[type="text"]:focus,
select:focus {
  border-color: var(--china-red);
  background: white;
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.15);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3E%3Cpath fill='%23C41E3A' d='M8 10L3 5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
}

/* ============================================
   关键词推荐标签 - 红包风格
   ============================================ */
.keyword-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px dashed var(--ink-light);
}

.tag-label {
  font-size: 0.75rem;
  color: var(--ink-gray);
  font-family: var(--font-serif);
}

.keyword-tag {
  padding: var(--space-1) var(--space-3);
  background: linear-gradient(135deg, var(--rice-paper-warm) 0%, var(--rice-paper) 100%);
  border: 1px solid var(--china-red);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--china-red);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.keyword-tag:hover {
  background: linear-gradient(135deg, var(--china-red) 0%, var(--china-red-dark) 100%);
  color: var(--gold);
  border-color: var(--gold-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-red);
}

.keyword-tag.active {
  background: linear-gradient(135deg, var(--china-red) 0%, var(--china-red-dark) 100%);
  color: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.3);
}

/* ============================================
   生成按钮 - 大红喜庆按钮
   ============================================ */
.generate-btn {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  margin-top: auto;
  background: linear-gradient(135deg, var(--china-red) 0%, var(--china-red-dark) 100%);
  color: var(--gold);
  border: 2px solid var(--gold-dark);
  border-radius: var(--radius-md);
  font-family: var(--font-calligraphy);
  font-size: 1.25rem;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  box-shadow: 
    var(--shadow-red),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  height: 52px;
}

.generate-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.2), transparent);
  transition: left 0.5s ease;
}

.generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 25px rgba(196, 30, 58, 0.5),
    0 0 20px rgba(255, 215, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.generate-btn:hover::before { left: 100%; }
.generate-btn:active { transform: translateY(0); }

.btn-icon {
  font-size: 1.375rem;
  filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

/* ============================================
   结果展示区 - 春联展示
   ============================================ */
.result-section { min-height: 0; }

.result-container {
  background: linear-gradient(135deg, var(--rice-paper-warm) 0%, var(--rice-paper) 100%);
  border: 2px solid var(--china-red);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow: auto;
}

.result-container .placeholder {
  color: var(--ink-light);
  font-size: 1rem;
  text-align: center;
}

.result-container .placeholder .icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: var(--space-3);
  opacity: 0.5;
}

/* 春联展示 */
.couplet-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  animation: fade-in-up 0.6s ease;
}

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

/* 横批 - 红底金字 */
.horizontal-scroll {
  background: linear-gradient(135deg, var(--china-red) 0%, var(--china-red-dark) 100%);
  color: var(--gold);
  padding: var(--space-2) var(--space-8);
  border-radius: var(--radius-sm);
  font-family: var(--font-calligraphy);
  font-size: 1.5rem;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  box-shadow: 
    var(--shadow-red),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  border: 2px solid var(--gold-dark);
}

.horizontal-scroll::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 2px;
  pointer-events: none;
}

/* 竖联容器 */
.vertical-couplets {
  display: flex;
  justify-content: center;
  gap: var(--space-10);
  margin-top: var(--space-2);
}

/* 竖联 - 红底金字 */
.vertical-scroll {
  background: linear-gradient(180deg, var(--china-red) 0%, var(--china-red-dark) 100%);
  color: var(--gold);
  padding: var(--space-5) var(--space-4);
  border-radius: var(--radius-sm);
  font-family: var(--font-calligraphy);
  font-size: 1.25rem;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 0.25em;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-red);
  border: 2px solid var(--gold-dark);
  position: relative;
}

.vertical-scroll::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 2px;
  pointer-events: none;
}

.vertical-scroll.black-text { 
  color: var(--ink-black);
  background: linear-gradient(180deg, #f5f5f5 0%, #e8e8e8 100%);
  border-color: var(--ink-gray);
}

.vertical-scroll.reverse { order: 2; }

/* ============================================
   操作按钮组
   ============================================ */
.action-buttons {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.action-btn {
  flex: 1;
  min-width: 90px;
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, var(--rice-paper-warm) 0%, var(--rice-paper) 100%);
  border: 2px solid var(--china-red);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--china-red);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  height: 42px;
}

.action-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--china-red) 0%, var(--china-red-dark) 100%);
  color: var(--gold);
  border-color: var(--gold-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-red);
}

.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.action-btn span { font-size: 1.125rem; }

/* ============================================
   历史记录区 - 左侧栏
   ============================================ */
.history-section {
  flex-shrink: 0;
}

.history-section .paper-effect {
  padding: var(--space-5);
  max-height: calc(100vh - 200px);
  height: 100%;
  overflow: hidden;
}

.history-section .section-title {
  margin-bottom: var(--space-4);
  font-size: 1.5rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-1);
  flex: 1;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-track {
  background: var(--rice-paper-aged);
  border-radius: 3px;
  margin: 4px 0;
}

.history-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--china-red) 0%, var(--china-red-dark) 100%);
  border-radius: 3px;
  border: 1px solid var(--gold-dark);
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--china-red-light) 0%, var(--china-red) 100%);
}

.history-item {
  flex: 0 0 auto;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(250, 240, 230, 0.9) 100%);
  border: 1px solid var(--rice-paper-aged);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.history-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--china-red);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.history-item:hover {
  background: white;
  border-color: var(--china-red);
  transform: translateX(4px);
  box-shadow: var(--shadow-red);
}

.history-item:hover::before { opacity: 1; }

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-1);
}

.history-item-keyword {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--china-red);
  background: rgba(196, 30, 58, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(196, 30, 58, 0.2);
}

.history-item-time {
  font-size: 0.6875rem;
  color: var(--ink-light);
}

.history-item-content {
  font-family: var(--font-calligraphy);
  font-size: 0.9375rem;
  color: var(--ink-black);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-item-content .horizontal {
  color: var(--china-red);
  margin-bottom: 2px;
}

/* ============================================
   春联科普板块
   ============================================ */
.knowledge-section {
  margin-top: var(--space-8);
  padding: 0 var(--space-4);
}

.knowledge-section .paper-effect {
  max-height: none;
  padding: var(--space-6);
  background: rgba(253, 245, 230, 0.92);
}

.knowledge-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

@media (max-width: 1024px) {
  .knowledge-content {
    grid-template-columns: 1fr;
  }
}

.knowledge-item {
  background: linear-gradient(135deg, rgba(255, 248, 240, 0.8) 0%, rgba(255, 245, 238, 0.6) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  border: 1px solid rgba(196, 30, 58, 0.1);
  transition: all 0.3s ease;
}

.knowledge-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(196, 30, 58, 0.2);
}

.knowledge-title {
  font-family: var(--font-calligraphy);
  font-size: 1.25rem;
  color: var(--china-red);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid rgba(196, 30, 58, 0.15);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.knowledge-body {
  color: var(--ink-black);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.knowledge-body p {
  margin-bottom: var(--space-2);
}

.knowledge-body ul {
  margin: var(--space-2) 0;
  padding-left: var(--space-4);
}

.knowledge-body li {
  margin-bottom: var(--space-1);
  position: relative;
}

.knowledge-body li::marker {
  color: var(--china-red);
}

.knowledge-body .highlight {
  color: var(--china-red);
  font-weight: 600;
}

.knowledge-body .tag {
  display: inline-block;
  background: linear-gradient(135deg, var(--china-red) 0%, #a01830 100%);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
}

.example-box {
  background: rgba(255, 215, 0, 0.1);
  border-left: 3px solid var(--gold-dark);
  padding: var(--space-3);
  margin-top: var(--space-3);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.example-title {
  font-weight: 600;
  color: var(--china-red);
  margin-bottom: var(--space-2);
}

.tone-ze {
  color: var(--china-red);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--china-red);
}

.tone-ping {
  color: #2e7d32;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: #2e7d32;
}

.tone-list {
  background: rgba(139, 69, 19, 0.05);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--ink-gray);
  margin: var(--space-2) 0;
}

.tip-box {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.05) 100%);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-top: var(--space-3);
}

.tip-box p {
  margin-bottom: var(--space-1);
}

.tip-box p:last-child {
  margin-bottom: 0;
}

/* ============================================
   2026年春联案例库
   ============================================ */
.gallery-section {
  margin-top: var(--space-8);
  padding: 0 var(--space-4);
}

.gallery-section .paper-effect {
  max-height: none;
  padding: var(--space-6);
  background: rgba(253, 245, 230, 0.92);
}

.gallery-subtitle {
  text-align: center;
  color: var(--ink-gray);
  font-size: 0.9375rem;
  margin-bottom: var(--space-5);
}

/* 分类标签 */
.gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(196, 30, 58, 0.1);
}

.gallery-tab {
  padding: var(--space-2) var(--space-4);
  border: 1px solid rgba(196, 30, 58, 0.2);
  border-radius: var(--radius-full);
  background: rgba(255, 248, 240, 0.5);
  color: var(--ink-gray);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-sans);
}

.gallery-tab:hover {
  background: rgba(196, 30, 58, 0.1);
  border-color: rgba(196, 30, 58, 0.4);
  transform: translateY(-1px);
}

.gallery-tab.active {
  background: linear-gradient(135deg, var(--china-red) 0%, #a01830 100%);
  color: white;
  border-color: var(--china-red);
  box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

/* 案例展示区域 */
.gallery-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 768px) {
  .gallery-content {
    grid-template-columns: 1fr;
  }
}

.gallery-item {
  display: block;
}

.gallery-item.hidden {
  display: none;
}

.gallery-card {
  background: linear-gradient(135deg, rgba(255, 248, 240, 0.9) 0%, rgba(255, 245, 238, 0.7) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  border: 1px solid rgba(196, 30, 58, 0.1);
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.gallery-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
  border-color: rgba(196, 30, 58, 0.2);
}

.gallery-header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px dashed rgba(196, 30, 58, 0.15);
}

.gallery-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
}

.gallery-tag.theme {
  background: linear-gradient(135deg, var(--china-red) 0%, #a01830 100%);
  color: white;
}

.gallery-tag.style {
  background: rgba(139, 69, 19, 0.1);
  color: var(--ink-gray);
}

.gallery-tag.style.funny {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
  color: white;
}

.gallery-tag.count {
  background: rgba(255, 215, 0, 0.2);
  color: var(--gold-dark);
}

.gallery-couplet {
  flex: 1;
  margin-bottom: var(--space-3);
}

.couplet-line {
  font-size: 0.9375rem;
  color: var(--ink-black);
  margin-bottom: var(--space-2);
  line-height: 1.6;
}

.couplet-line .label {
  color: var(--ink-gray);
  font-size: 0.8125rem;
  margin-right: var(--space-1);
}

.couplet-line.horizontal {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid rgba(196, 30, 58, 0.1);
}

.couplet-line.horizontal .label {
  color: var(--china-red);
  font-weight: 600;
}

.use-btn {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold-dark) 100%);
  color: var(--ink-black);
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-sans);
}

.use-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

/* ============================================
   页脚
   ============================================ */
.footer {
  text-align: center;
  padding: var(--space-4) 0 var(--space-2);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.875rem;
  border-top: 1px solid rgba(255, 215, 0, 0.2);
  margin-top: var(--space-4);
  flex-shrink: 0;
}

/* ============================================
   加载动画
   ============================================ */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(102, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 1;
  visibility: visible;
  transition: all 0.3s ease;
}

.loading.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  color: var(--gold);
}

.loading-lantern {
  font-size: 4rem;
  animation: lantern-pulse 1.2s ease-in-out infinite;
  margin-bottom: var(--space-4);
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
}

@keyframes lantern-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.loading-content p {
  font-family: var(--font-calligraphy);
  font-size: 1.25rem;
  letter-spacing: 0.2em;
  color: var(--gold);
}

/* ============================================
   Toast 提示
   ============================================ */
.toast {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(135deg, var(--china-red-dark) 0%, var(--china-red) 100%);
  color: var(--gold);
  padding: var(--space-3) var(--space-6);
  border-radius: 100px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  z-index: 3000;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-red), var(--shadow-gold);
  border: 1px solid var(--gold-dark);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============================================
   响应式优化
   ============================================ */
@media (max-height: 800px) {
  .paper-effect {
    padding: var(--space-4);
  }
  
  .section-title {
    font-size: 1.25rem;
    margin-bottom: var(--space-3);
  }
  
  .form-group {
    margin-bottom: var(--space-2);
  }
  
  .vertical-scroll {
    min-height: 140px;
    font-size: 1.125rem;
  }
  
  .horizontal-scroll {
    font-size: 1.25rem;
  }
}

/* ============================================
   特殊效果
   ============================================ */
.glow-gold {
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.4);
}

.seal {
  display: inline-block;
  background: var(--cinnabar);
  color: white;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-calligraphy);
  font-size: 0.8125rem;
  transform: rotate(-3deg);
  box-shadow: var(--shadow-red);
}

/* ============================================
   生成进度弹窗
   ============================================ */
.progress-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(102, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  transition: all 0.3s ease;
}

.progress-modal.hidden {
  opacity: 0;
  visibility: hidden;
}

.progress-content {
  background: linear-gradient(135deg, var(--rice-paper) 0%, var(--rice-paper-warm) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-10);
  text-align: center;
  box-shadow: var(--shadow-card), 0 0 50px rgba(255, 215, 0, 0.3);
  border: 2px solid var(--gold-dark);
  min-width: 320px;
  max-width: 90%;
}

.progress-icon {
  font-size: 3.5rem;
  margin-bottom: var(--space-4);
  animation: lantern-pulse 1.2s ease-in-out infinite;
  filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
}

.progress-title {
  font-family: var(--font-calligraphy);
  font-size: 1.5rem;
  color: var(--china-red);
  margin-bottom: var(--space-5);
  letter-spacing: 0.1em;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--rice-paper-aged);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--space-4);
  border: 1px solid var(--gold-dark);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--china-red) 0%, var(--gold) 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.progress-status {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink-gray);
  margin-bottom: var(--space-2);
}

.progress-time {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--ink-light);
}

/* ============================================
   移动端响应式优化
   ============================================ */
@media (max-width: 768px) {
  body {
    overflow-y: auto;
    height: auto;
  }

  .main-container {
    height: auto;
    padding: var(--space-4);
  }

  .content {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    overflow-y: visible;
  }

  .history-section {
    grid-column: auto;
    order: 0;
  }

  .lantern {
    width: 36px;
    height: 48px;
  }

  .lantern::before {
    font-size: 1.125rem;
  }

  .paper-effect {
    max-height: none;
    height: auto;
  }

  .config-section,
  .result-section,
  .history-section {
    height: auto;
    min-height: auto;
  }
}
