/* ===== 全局样式 ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700;900&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
  --red-primary: #c41e3a;
  --red-dark: #8b1a2b;
  --red-light: #e8546d;
  --gold-primary: #d4a843;
  --gold-light: #f0d68a;
  --gold-dark: #a07d2e;
  --bg-cream: #faf7f0;
  --bg-card: #ffffff;
  --text-dark: #2c1810;
  --text-medium: #5a4a3e;
  --text-light: #8a7a6e;
  --border-light: #e8ddd0;
  --shadow-soft: 0 2px 12px rgba(140, 100, 60, 0.08);
  --shadow-medium: 0 4px 20px rgba(140, 100, 60, 0.12);
  --shadow-strong: 0 8px 32px rgba(140, 100, 60, 0.16);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background-color: var(--bg-cream);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== 背景装饰 ===== */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(196, 30, 58, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(212, 168, 67, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(250, 247, 240, 0.5) 0%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

/* ===== 顶部标题区 ===== */
.header {
  text-align: center;
  padding: 50px 20px 40px;
  position: relative;
  z-index: 1;
}

.header-decoration {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.cloud-left, .cloud-right {
  font-size: 28px;
  opacity: 0.5;
  color: var(--gold-primary);
}

.header-icon {
  font-size: 36px;
}

.header h1 {
  font-family: 'Noto Serif SC', serif;
  font-size: 2.8em;
  font-weight: 900;
  background: linear-gradient(135deg, var(--red-primary) 0%, var(--red-dark) 40%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 8px;
  margin-bottom: 8px;
}

.header .subtitle {
  font-family: 'Noto Serif SC', serif;
  font-size: 1em;
  color: var(--text-light);
  letter-spacing: 4px;
}

.divider {
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
  margin: 16px auto 0;
}

/* ===== 主容器 ===== */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 60px;
  position: relative;
  z-index: 1;
}

/* ===== 表单区域 ===== */
.form-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: var(--shadow-medium);
  border: 1px solid var(--border-light);
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.form-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red-primary), var(--gold-primary), var(--red-primary));
}

.form-card h2 {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.3em;
  color: var(--red-dark);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.9em;
  font-weight: 500;
  color: var(--text-medium);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.form-group input,
.form-group select {
  padding: 10px 14px;
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  font-size: 1em;
  font-family: 'Noto Sans SC', sans-serif;
  color: var(--text-dark);
  background: #fefcf8;
  transition: all 0.3s ease;
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.15);
}

.form-group input::placeholder {
  color: var(--text-light);
}

/* 五行选择按钮组 */
.wuxing-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.wuxing-btn {
  padding: 8px 16px;
  border: 1.5px solid var(--border-light);
  border-radius: 20px;
  background: #fefcf8;
  cursor: pointer;
  font-size: 0.9em;
  font-family: 'Noto Sans SC', sans-serif;
  color: var(--text-medium);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wuxing-btn:hover {
  border-color: var(--gold-primary);
  background: rgba(212, 168, 67, 0.05);
}

.wuxing-btn.active {
  border-color: var(--red-primary);
  background: rgba(196, 30, 58, 0.08);
  color: var(--red-primary);
  font-weight: 500;
}

.wuxing-icon {
  font-size: 1em;
}

/* 风格选择 */
.style-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.style-btn {
  padding: 8px 18px;
  border: 1.5px solid var(--border-light);
  border-radius: 20px;
  background: #fefcf8;
  cursor: pointer;
  font-size: 0.9em;
  font-family: 'Noto Sans SC', sans-serif;
  color: var(--text-medium);
  transition: all 0.3s ease;
}

.style-btn:hover {
  border-color: var(--gold-primary);
  background: rgba(212, 168, 67, 0.05);
}

.style-btn.active {
  border-color: var(--red-primary);
  background: rgba(196, 30, 58, 0.08);
  color: var(--red-primary);
  font-weight: 500;
}

/* ===== 按钮 ===== */
.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  justify-content: center;
}

.btn-generate {
  padding: 12px 40px;
  border: none;
  border-radius: 12px;
  font-size: 1.05em;
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
  color: #fff;
  box-shadow: 0 4px 15px rgba(196, 30, 58, 0.3);
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(196, 30, 58, 0.4);
}

.btn-generate:active {
  transform: translateY(0);
}

.btn-refresh {
  padding: 12px 32px;
  border: 1.5px solid var(--gold-primary);
  border-radius: 12px;
  font-size: 1.05em;
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 2px;
  background: transparent;
  color: var(--gold-dark);
  display: none;
}

.btn-refresh:hover {
  background: rgba(212, 168, 67, 0.1);
  transform: translateY(-2px);
}

.btn-refresh.visible {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ===== 结果区域 ===== */
.results-section {
  margin-top: 16px;
}

.results-header {
  text-align: center;
  margin-bottom: 24px;
}

.results-header h2 {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.4em;
  color: var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.results-count {
  font-size: 0.85em;
  color: var(--text-light);
  margin-top: 4px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ===== 名字卡片 ===== */
.name-card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

.name-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-strong);
  border-color: var(--gold-light);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.name-card:nth-child(1) { animation-delay: 0.05s; }
.name-card:nth-child(2) { animation-delay: 0.1s; }
.name-card:nth-child(3) { animation-delay: 0.15s; }
.name-card:nth-child(4) { animation-delay: 0.2s; }
.name-card:nth-child(5) { animation-delay: 0.25s; }
.name-card:nth-child(6) { animation-delay: 0.3s; }
.name-card:nth-child(7) { animation-delay: 0.35s; }
.name-card:nth-child(8) { animation-delay: 0.4s; }
.name-card:nth-child(9) { animation-delay: 0.45s; }
.name-card:nth-child(10) { animation-delay: 0.5s; }
.name-card:nth-child(11) { animation-delay: 0.55s; }
.name-card:nth-child(12) { animation-delay: 0.6s; }

.card-wuxing-strip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.wuxing-金 { background: linear-gradient(90deg, #d4a843, #f0d68a); }
.wuxing-木 { background: linear-gradient(90deg, #4a8c3f, #7bc462); }
.wuxing-水 { background: linear-gradient(90deg, #2d6da5, #5ba3d9); }
.wuxing-火 { background: linear-gradient(90deg, #c41e3a, #e8546d); }
.wuxing-土 { background: linear-gradient(90deg, #8b6e4e, #c4a87c); }

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.card-name {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.8em;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: 4px;
}

.card-pinyin {
  font-size: 0.8em;
  color: var(--text-light);
  margin-top: 2px;
  letter-spacing: 1px;
}

.card-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 500;
}

.badge-wuxing {
  color: #fff;
}

.badge-金 { background: linear-gradient(135deg, #d4a843, #b8922f); }
.badge-木 { background: linear-gradient(135deg, #4a8c3f, #3a7030); }
.badge-水 { background: linear-gradient(135deg, #2d6da5, #225a8c); }
.badge-火 { background: linear-gradient(135deg, #c41e3a, #a0182e); }
.badge-土 { background: linear-gradient(135deg, #8b6e4e, #725a3e); }

.badge-strokes {
  background: rgba(0,0,0,0.04);
  color: var(--text-light);
  border: 1px solid var(--border-light);
}

.card-meaning {
  font-size: 0.9em;
  color: var(--text-medium);
  line-height: 1.7;
  margin-bottom: 10px;
}

.card-poem {
  font-size: 0.82em;
  color: var(--text-light);
  font-style: italic;
  padding: 8px 12px;
  background: rgba(212, 168, 67, 0.06);
  border-left: 2px solid var(--gold-light);
  border-radius: 0 6px 6px 0;
  line-height: 1.6;
}

.card-poem::before {
  content: '📖 ';
}

/* ===== 底部说明 ===== */
.footer {
  text-align: center;
  padding: 40px 20px 30px;
  color: var(--text-light);
  font-size: 0.85em;
  position: relative;
  z-index: 1;
}

.footer .footer-divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-light), transparent);
  margin: 0 auto 16px;
}

.footer p {
  margin-bottom: 4px;
}

.footer .footer-note {
  font-size: 0.9em;
  color: #bbb;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state .empty-icon {
  font-size: 3em;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 1em;
  letter-spacing: 1px;
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 40px;
}

.loading-dots {
  display: inline-flex;
  gap: 6px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-primary);
  animation: bounce 1.2s infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .header {
    padding: 36px 16px 28px;
  }
  
  .header h1 {
    font-size: 2.2em;
    letter-spacing: 6px;
  }
  
  .header .subtitle {
    font-size: 0.9em;
  }

  .container {
    padding: 0 12px 40px;
  }
  
  .form-card {
    padding: 24px 18px;
    border-radius: 12px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .results-grid {
    grid-template-columns: 1fr;
  }
  
  .btn-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn-generate, .btn-refresh {
    text-align: center;
    justify-content: center;
  }
  
  .wuxing-options, .style-options {
    gap: 6px;
  }
  
  .wuxing-btn, .style-btn {
    padding: 7px 12px;
    font-size: 0.85em;
  }
  
  .name-card {
    padding: 18px;
  }
  
  .card-name {
    font-size: 1.5em;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.8em;
    letter-spacing: 4px;
  }
  
  .header-icon {
    font-size: 28px;
  }
  
  .cloud-left, .cloud-right {
    font-size: 22px;
  }
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-cream);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}
