/* ===== 真有才 - AI 取名 ===== */
:root {
  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --primary-light: #a78bfa;
  --primary-bg: #f5f3ff;
  --accent: #f59e0b;
  --accent-bg: #fffbeb;
  --bg: #f8fafc;
  --bg-gradient: linear-gradient(180deg, #ede9fe 0%, #f5f3ff 30%, #f8fafc 60%, #ffffff 100%);
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,.08), 0 4px 10px -6px rgba(0,0,0,.04);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Header ===== */
.site-header {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

.logo-icon {
  border-radius: 10px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.logo-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 56px 20px 36px;
  max-width: 700px;
  margin: 0 auto;
  position: relative;
}
.hero-accent {
  width: 48px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 2px;
  margin: 0 auto 20px;
}
.hero h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -.02em;
  line-height: 1.25;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero .hero-sub {
  font-size: 15px;
  color: var(--text-muted);
  letter-spacing: 2px;
}

/* ===== Tab Switcher ===== */
.tab-bar {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 0 auto 28px;
  max-width: 400px;
  background: var(--border);
  border-radius: 10px;
  padding: 3px;
}
.tab-btn {
  flex: 1;
  padding: 10px 20px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .25s;
  color: var(--text-muted);
}
.tab-btn.active {
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: var(--shadow-md);
}
.tab-btn:hover:not(.active) { color: var(--text); }

/* ===== Container ===== */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ===== Form Card ===== */
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  display: none;
}
.form-card.active { display: block; }

.form-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.form-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-bg);
  border-radius: 8px;
  font-size: 16px;
}
.form-card h2 {
  font-size: 18px;
  font-weight: 700;
}
.form-card .form-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
  margin-left: 42px;
}

/* ===== Form Grid ===== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
.form-row.full { grid-template-columns: 1fr; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-group label .required { color: #ef4444; margin-left: 2px; }
.form-group label .optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
  margin-left: 4px;
}

input[type="text"],
input[type="date"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  background: var(--bg);
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}
textarea { resize: vertical; min-height: 70px; }

/* ===== Date Select (三列下拉) ===== */
.date-select-group {
  display: flex;
  gap: 8px;
}
.date-select-group select {
  text-align: center;
  text-align-last: center;
  padding: 10px 8px;
}

/* ===== Button Styles ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all .25s;
  box-shadow: 0 4px 14px rgba(124, 58, 237, .3);
  letter-spacing: .5px;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124, 58, 237, .35);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary .spinner { display: none; }
.btn-primary.loading .spinner {
  display: inline-block;
  animation: spin .8s linear infinite;
}
.btn-primary.loading .btn-text { display: none; }

.btn-secondary {
  padding: 10px 28px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .25s;
  color: var(--text);
}
.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

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

/* ===== Radio Group ===== */
.radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg);
}
.radio-group label:hover { border-color: var(--primary-light); }
.radio-group input[type="radio"] { display: none; }
.radio-group input[type="radio"]:checked + label,
.radio-group label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

/* ===== Tag Selector ===== */
.tag-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tag-group label {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg);
  user-select: none;
}
.tag-group label:hover { border-color: var(--primary-light); }
.tag-group input[type="checkbox"] { display: none; }
.tag-group input[type="checkbox"]:checked + label,
.tag-group label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.submit-area .btn-primary:active { transform: scale(.96); }

.disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
  opacity: .7;
}

/* ===== Limit Bar ===== */
.limit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  margin-bottom: 0;
  font-size: 13px;
}
.limit-bar .count { font-weight: 700; color: #16a34a; font-size: 15px; }
.limit-bar .count.exhausted { color: #ef4444; }

/* ===== Submit Area ===== */
.submit-area {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ===== Results ===== */
.results-section {
  display: none;
  margin-top: 28px;
}
.results-section.show { display: block; }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.results-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.results-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-bg), #fef3c7);
  border-radius: 6px;
  font-size: 14px;
}
.results-header h3 {
  font-size: 17px;
  font-weight: 700;
}
.results-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.result-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all .25s;
  position: relative;
}
.result-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}
.result-card .card-badge {
  position: absolute;
  top: -8px;
  right: 12px;
  background: linear-gradient(135deg, var(--accent), #d97706);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
}
.result-card .card-badge.top1 { background: linear-gradient(135deg, #ef4444, #dc2626); }
.result-card .card-badge.top2 { background: linear-gradient(135deg, var(--accent), #d97706); }
.result-card .card-badge.top3 { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.result-card .name {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.result-card .name .pinyin {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}
.result-card .score {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.result-card .meaning {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}
.result-card .origin {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 8px;
}
.result-card .tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.result-card .tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--primary-bg);
  color: var(--primary);
}
.result-card .tag-nickname {
  background: #fef3c7;
  color: #92400e;
}
.result-card .tag-english {
  background: #dbeafe;
  color: #1e40af;
}
.result-card .extras {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e5e7eb;
}

.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ===== Additional Names ===== */
.names-extra {
  display: none;
  margin-top: 14px;
}
.names-extra.show { display: block; }
.names-extra .result-grid { grid-template-columns: 1fr 1fr 1fr; }
.names-extra .result-card { padding: 14px; }

/* ===== Footer ===== */
.site-footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px;
  text-align: center;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--primary); text-decoration: none; }
.footer-legal {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: .7;
}

/* ===== 广告位 ===== */
.ad-section {
  margin: 20px 0;
  text-align: center;
}
.ad-placeholder {
  background: var(--card-bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .site-header { display: none; }
  .hero { padding: 32px 16px 24px; }
  .hero-accent { width: 36px; margin-bottom: 16px; }
  .hero h1 { font-size: 24px; }
  .hero .hero-sub { font-size: 13px; }
  .form-card { padding: 20px 16px; }
  .form-card .form-subtitle { margin-left: 0; font-size: 12px; }
  .form-row { grid-template-columns: 1fr; gap: 12px; }
  .tab-bar { max-width: 100%; }
  .tab-btn { font-size: 14px; padding: 8px 12px; }
  .result-grid { grid-template-columns: 1fr; }
  .names-extra .result-grid { grid-template-columns: 1fr; }
  .btn-primary { width: 100%; justify-content: center; }
  .result-actions { flex-direction: column; align-items: stretch; }
  .date-select-group { gap: 6px; }
  .date-select-group select {
    font-size: 13px;
    padding: 10px 4px;
    padding-right: 20px;
    background-position: right 4px center;
  }
}

/* ===== AI 思考中遮罩 ===== */
.thinking-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  background: rgba(0, 0, 0, .55);
  justify-content: center;
  align-items: center;
  animation: fadeIn .2s ease;
}
.thinking-overlay.show { display: flex; }

.thinking-box {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 40px 48px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  animation: scaleIn .3s ease;
}

.thinking-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: thinkPulse 1.5s ease-in-out infinite;
}

.thinking-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}

.thinking-progress {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7c3aed, #a855f7);
  border-radius: 3px;
  transition: width .6s ease;
}

.thinking-msg {
  font-size: 16px;
  font-weight: 600;
  color: #7c3aed;
  margin-bottom: 6px;
  min-height: 24px;
}

.thinking-sub {
  font-size: 13px;
  color: var(--text-muted);
}

@keyframes thinkPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.85); }
  to { opacity: 1; transform: scale(1); }
}

/* ===== 验证码弹窗 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  z-index: 99999;
  background: rgba(0,0,0,.55);
  justify-content: center;
  align-items: center;
  animation: fadeIn .2s ease;
}
.modal-overlay.show { display: flex; }

.modal-box {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 32px;
  max-width: 340px;
  width: 88%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: scaleIn .3s ease;
}
.modal-box h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.modal-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.captcha-puzzle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}
.captcha-puzzle .question {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  background: var(--bg);
  padding: 8px 20px;
  border-radius: 12px;
  min-width: 100px;
  text-align: center;
}
.captcha-puzzle input {
  width: 80px;
  height: 48px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 12px;
  outline: none;
  transition: border-color .2s;
  -moz-appearance: textfield;
}
.captcha-puzzle input::-webkit-inner-spin-button,
.captcha-puzzle input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.captcha-puzzle input:focus {
  border-color: var(--primary);
}

.captcha-error {
  display: none;
  font-size: 14px;
  color: #ef4444;
  margin-bottom: 16px;
}
.captcha-error.show { display: block; }

.captcha-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.btn-refresh {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border);
  background: var(--card-bg);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all .2s;
}
.btn-refresh:active { transform: scale(.96); }

.btn-confirm {
  flex: 1;
  padding: 12px;
  border: none;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: all .2s;
}
.btn-confirm:active { transform: scale(.96); }

/* ===== Medium screens ===== */
@media (min-width: 641px) and (max-width: 1024px) {
  .result-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== 6 cards layout: PC 3列×2行 ===== */
@media (min-width: 641px) and (max-width: 900px) {
  .result-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 901px) {
  .result-grid.grid-6 { grid-template-columns: repeat(3, 1fr); }
}
