/* ============================================
   阳光角落 · 八字命理分析师
   响应式 + 暗色主题 + 移动端优先
   ============================================ */

:root {
  --bg-primary:   #0a0e1a;
  --bg-secondary: #141a2a;
  --bg-card:      #1a2238;
  --bg-glass:     rgba(26, 34, 56, 0.85);
  --gold-1:       #f4d35e;
  --gold-2:       #ee964b;
  --gold-3:       #d4a373;
  --gold-light:   #fcd34d;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted:   #94a3b8;
  --border:       rgba(244, 211, 94, 0.18);
  --border-strong:rgba(244, 211, 94, 0.4);
  --shadow-glow:  0 8px 32px rgba(244, 211, 94, 0.12);
  --shadow-deep:  0 16px 48px rgba(0, 0, 0, 0.45);
  --wood:  #6dd58f;  /* 木-绿 */
  --fire:  #ff7a7a;  /* 火-红 */
  --earth: #f4d35e;  /* 土-金 */
  --metal: #e6e1c5;  /* 金-白 */
  --water: #6fb3d2;  /* 水-蓝 */

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 28px;
}

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

html, body {
  width: 100%;
  overflow-x: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei',
               'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(244, 211, 94, 0.08), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(238, 150, 75, 0.06), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ===== 顶部 Header ===== */
.site-header {
  position: relative;
  width: 100%;
  text-align: center;
  z-index: 10;
  padding: 0;
  overflow: hidden;
}

.logo-wrap {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  border-bottom: 2px solid var(--border-strong);
  background: #000;
}

.logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.78) saturate(1.05);
}

.logo-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(180deg, rgba(10,14,26,0.20) 0%, rgba(10,14,26,0.65) 100%);
  text-align: center;
  padding: 20px;
}

.site-title {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--gold-1) 0%, var(--gold-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 24px rgba(244, 211, 94, 0.35);
  margin-bottom: 12px;
}

.site-slogan {
  font-size: clamp(15px, 2.4vw, 19px);
  font-weight: 500;
  color: #fff7d6;
  letter-spacing: 0.12em;
  font-style: italic;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
  padding: 6px 18px;
  border-top: 1px solid rgba(255,255,255,0.4);
  border-bottom: 1px solid rgba(255,255,255,0.4);
  display: inline-block;
}

/* ===== 主体容器 ===== */
.container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  z-index: 1;
}

.intro-text {
  text-align: center;
  margin: 0 auto 36px;
  max-width: 720px;
  color: var(--text-secondary);
  font-size: clamp(14px, 1.8vw, 16px);
  line-height: 1.8;
}
.intro-text strong { color: var(--gold-1); }

/* ===== 表单卡片 ===== */
.input-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-deep);
  max-width: 800px;
  margin: 0 auto 36px;
}

.input-card h2 {
  font-size: 22px;
  color: var(--gold-1);
  margin-bottom: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.input-card h2::before {
  content: '';
  width: 4px;
  height: 22px;
  background: linear-gradient(to bottom, var(--gold-1), var(--gold-2));
  border-radius: 2px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
}
.form-field input, .form-field select {
  background: rgba(10, 14, 26, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s;
}
.form-field input:focus, .form-field select:focus {
  outline: none;
  border-color: var(--gold-1);
  background: rgba(10, 14, 26, 0.85);
  box-shadow: 0 0 0 3px rgba(244, 211, 94, 0.15);
}

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

.btn-primary {
  display: inline-block;
  width: 100%;
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--gold-1) 0%, var(--gold-2) 100%);
  color: #1a1a1a;
  border: none;
  border-radius: var(--radius-md);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 24px rgba(244, 211, 94, 0.3);
  margin-top: 12px;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(244, 211, 94, 0.45);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  padding: 10px 20px;
  background: transparent;
  color: var(--gold-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: 8px;
  margin-top: 8px;
}
.btn-secondary:hover {
  background: rgba(244, 211, 94, 0.1);
}

/* ===== 结果区 ===== */
.result-area { display: none; }
.result-area.visible { display: block; }

.result-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-deep);
}
.result-section h2 {
  font-size: 22px;
  color: var(--gold-1);
  margin-bottom: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.result-section h2::before {
  content: '';
  width: 4px;
  height: 22px;
  background: linear-gradient(to bottom, var(--gold-1), var(--gold-2));
  border-radius: 2px;
}

/* 四柱表 */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.pillar-cell {
  background: rgba(10, 14, 26, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 12px;
  text-align: center;
  position: relative;
}
.pillar-cell .label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.pillar-cell .gan,
.pillar-cell .zhi {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  margin: 4px 0;
}
.pillar-cell .gan { color: var(--gold-1); }
.pillar-cell .zhi { color: var(--gold-3); }
.pillar-cell .canggan {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 0.05em;
}
.pillar-cell .shishen {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(244, 211, 94, 0.15);
  color: var(--gold-1);
  margin-top: 6px;
}

/* 五行 + 用神 */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}
.summary-card {
  background: rgba(10, 14, 26, 0.45);
  border-radius: var(--radius-md);
  padding: 18px;
  border: 1px solid var(--border);
}
.summary-card h4 {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.summary-card .big-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-1);
  margin-bottom: 4px;
}
.summary-card .sub {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 五行柱状图 */
.wuxing-bar {
  display: flex;
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
  background: rgba(255,255,255,0.04);
}
.wuxing-bar .seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #000;
  transition: width 0.4s ease;
}
.wuxing-legend {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
  font-size: 13px;
}
.wuxing-legend .item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.wuxing-legend .dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* 大运 timeline */
.dayun-timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.dayun-cell {
  background: rgba(10, 14, 26, 0.55);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  border: 1px solid var(--border);
}
.dayun-cell.current {
  background: rgba(244, 211, 94, 0.18);
  border-color: var(--gold-1);
  box-shadow: 0 0 0 2px rgba(244, 211, 94, 0.3);
}
.dayun-cell .pz {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold-1);
  margin-bottom: 6px;
}
.dayun-cell .age {
  font-size: 12px;
  color: var(--text-muted);
}
.dayun-cell .years {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.dayun-cell .ss {
  font-size: 11px;
  color: var(--gold-3);
  margin-top: 4px;
}

/* 流年表 */
.liunian-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.liunian-table th, .liunian-table td {
  padding: 10px 8px;
  text-align: center;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.liunian-table th {
  background: rgba(10, 14, 26, 0.7);
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.1em;
  font-size: 11px;
  text-transform: uppercase;
}
.liunian-table td { color: var(--text-secondary); }
.liunian-table .pillar-text {
  font-weight: 700;
  color: var(--gold-1);
  font-size: 15px;
}
.liunian-table .current {
  background: rgba(244, 211, 94, 0.1);
}

/* 四维度分析 */
.dim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.dim-card {
  background: rgba(10, 14, 26, 0.5);
  border-radius: var(--radius-md);
  padding: 18px;
  border: 1px solid var(--border);
}
.dim-card h4 {
  font-size: 16px;
  color: var(--gold-1);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dim-card h4 .icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  color: #1a1a1a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.dim-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.7;
}
.dim-card ul {
  list-style: none;
  padding-left: 0;
}
.dim-card li {
  font-size: 12.5px;
  color: var(--text-secondary);
  padding-left: 16px;
  position: relative;
  margin-bottom: 4px;
  line-height: 1.6;
}
.dim-card li::before {
  content: '◆';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--gold-1);
  font-size: 10px;
}

/* 免责声明 */
.disclaimer {
  background: rgba(255, 122, 122, 0.05);
  border: 1px solid rgba(255, 122, 122, 0.18);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-top: 30px;
}
.disclaimer strong {
  color: #ffb3b3;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 60px;
}
.site-footer a {
  color: var(--gold-1);
  text-decoration: none;
}
.site-footer a:hover { text-decoration: underline; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .logo-wrap { height: 220px; }
  .container { padding: 24px 16px 60px; }
  .input-card { padding: 24px 18px; }
  .pillars-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-grid { grid-template-columns: 1fr; }
  .dayun-timeline { grid-template-columns: repeat(2, 1fr); }
  .pillar-cell .gan, .pillar-cell .zhi { font-size: 28px; }
}

@media (max-width: 480px) {
  .logo-wrap { height: 180px; }
  .site-slogan { font-size: 13px; padding: 4px 12px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== Loading ===== */
.loading {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 26, 0.85);
  z-index: 100;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 16px;
}
.loading.visible { display: flex; }
.loading .spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(244, 211, 94, 0.2);
  border-top-color: var(--gold-1);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 登录遮罩层 ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(ellipse at center, #141a2a 0%, #0a0e1a 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.4s ease;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.login-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.login-card {
  text-align: center;
  padding: 40px 36px 32px;
  max-width: 380px;
  width: 90%;
}

.login-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border-strong);
  box-shadow: 0 0 24px rgba(244, 211, 94, 0.25);
  animation: logoGlow 3s ease-in-out infinite alternate;
}
.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@keyframes logoGlow {
  from { box-shadow: 0 0 16px rgba(244, 211, 94, 0.15); }
  to   { box-shadow: 0 0 32px rgba(244, 211, 94, 0.40); }
}

.login-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, var(--gold-1) 0%, var(--gold-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.login-slogan {
  font-size: 14px;
  color: #fff7d6;
  font-style: italic;
  letter-spacing: 0.1em;
  margin-bottom: 32px;
  padding: 4px 14px;
  border-top: 1px solid rgba(255,255,255,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.3);
  display: inline-block;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field input {
  width: 100%;
  background: rgba(10, 14, 26, 0.7);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  transition: all 0.2s;
}
.login-field input:focus {
  outline: none;
  border-color: var(--gold-1);
  background: rgba(10, 14, 26, 0.9);
  box-shadow: 0 0 0 3px rgba(244, 211, 94, 0.15);
}
.login-field input::placeholder {
  color: var(--text-muted);
  letter-spacing: normal;
}

.login-btn {
  padding: 14px;
  background: linear-gradient(135deg, var(--gold-1) 0%, var(--gold-2) 100%);
  color: #1a1a1a;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(244, 211, 94, 0.3);
}
.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(244, 211, 94, 0.45);
}
.login-btn:active { transform: translateY(0); }

.login-error {
  color: #ff7a7a;
  font-size: 13px;
  min-height: 18px;
  margin-top: 4px;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.login-hint {
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ===== 出生地点输入 ===== */
.place-input-wrap {
  position: relative;
}

.place-input-wrap input {
  width: 100%;
  background: rgba(10, 14, 26, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s;
}
.place-input-wrap input:focus {
  outline: none;
  border-color: var(--gold-1);
  background: rgba(10, 14, 26, 0.85);
  box-shadow: 0 0 0 3px rgba(244, 211, 94, 0.15);
}

.place-suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow-deep);
}
.place-suggestions.visible { display: block; }

.place-suggestions .suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(244, 211, 94, 0.08);
  transition: all 0.15s;
  display: flex;
  justify-content: space;
  align-items: center;
  gap: 8px;
}
.place-suggestions .suggestion-item:last-child { border-bottom: none; }
.place-suggestions .suggestion-item:hover,
.place-suggestions .suggestion-item.active {
  background: rgba(244, 211, 94, 0.12);
  color: var(--gold-1);
}
.place-suggestions .suggestion-item .city-name {
  font-weight: 600;
}
.place-suggestions .suggestion-item .city-province {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}
.place-suggestions .suggestion-item .city-lng {
  font-size: 11px;
  color: var(--gold-3);
  white-space: nowrap;
}

.place-resolved {
  font-size: 12px;
  color: var(--gold-3);
  margin-top: 4px;
  min-height: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.place-resolved.error {
  color: #ff7a7a;
}
.place-resolved.success::before {
  content: '\2713';
  color: var(--wood);
  font-weight: 700;
}
.place-resolved.loading::before {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid rgba(244, 211, 94, 0.2);
  border-top-color: var(--gold-1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== 错误提示 ===== */
.error-msg {
  background: rgba(255, 100, 100, 0.1);
  border: 1px solid rgba(255, 100, 100, 0.3);
  color: #ffb3b3;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-top: 12px;
  font-size: 14px;
  display: none;
}
.error-msg.visible { display: block; }

/* 打印样式 */
@media print {
  .site-header, .input-card, .site-footer, .btn-primary, .btn-secondary { display: none !important; }
  body { background: #fff; color: #000; }
  .result-section { background: #fff; border: 1px solid #ccc; color: #000; page-break-inside: avoid; }
}
