/* AI三千问 · 紫微斗数 — 暖金暗调 */
:root {
  --bg-deep: #0f0f14;
  --bg-card: #1a1a24;
  --bg-cell: #14141c;
  --border: #2a2a36;
  --border-accent: #3a3a46;
  --gold: #c9a96e;
  --gold-dim: #c9a96e88;
  --gold-faint: #c9a96e22;
  --text: #e8e0d4;
  --text-dim: #8a8580;
  --text-muted: #5a5550;
  --sihua-lu: #6ebf6e;
  --sihua-quan: #e8c84a;
  --sihua-ke: #5ea3d0;
  --sihua-ji: #d05a5a;
  --star-main: #e8d5a3;
  --star-aux: #7a8a9a;
  --radius: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body {
  background: var(--bg-deep); color: var(--text);
  font-family: "Noto Serif SC", "Source Han Serif SC", serif;
  min-height: 100vh; line-height: 1.6; overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 20%, var(--gold-faint) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 60%, rgba(100,140,200,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(201,169,110,0.03) 0%, transparent 40%);
}

/* ===== Layout ===== */
.app-wrapper {
  position: relative; z-index: 1;
  max-width: 780px; margin: 0 auto; padding: 2rem 1rem 4rem;
}

/* ===== Header ===== */
.app-header { text-align: center; padding: 1.5rem 0 0.8rem; }
.app-header .back {
  display: inline-block; margin-bottom: 0.8rem;
  font-size: 0.82rem; color: var(--gold-dim); text-decoration: none;
  font-family: "Noto Sans SC", sans-serif; letter-spacing: 0.06em;
  transition: color 0.2s;
}
.app-header .back:hover { color: var(--gold); }
.app-header .emblem { font-size: 2.5rem; margin-bottom: 0.3rem; }
.app-header h1 {
  font-size: 2.2rem; font-weight: 700; letter-spacing: 0.3em;
  background: linear-gradient(135deg, var(--gold) 0%, #e8d5a3 50%, var(--gold) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.app-header .subtitle {
  font-size: 0.85rem; color: var(--gold-dim); letter-spacing: 0.15em; margin-top: 0.2rem;
  font-family: "Noto Sans SC", "PingFang SC", sans-serif;
}

/* ===== Input ===== */
.input-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem 1.6rem; margin: 1.2rem 0;
}
.input-row {
  display: flex; gap: 0.8rem; align-items: flex-end; flex-wrap: wrap; justify-content: center;
}
.input-group { display: flex; flex-direction: column; gap: 0.3rem; }
.input-group label {
  font-size: 0.74rem; color: var(--text-dim); letter-spacing: 0.06em;
  font-family: "Noto Sans SC", sans-serif;
}
.input-group input,
.input-group select {
  background: var(--bg-deep); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0.5rem 0.7rem; font-size: 0.9rem;
  font-family: inherit; outline: none; transition: border-color 0.2s;
  min-width: 72px;
}
.input-group input:focus,
.input-group select:focus { border-color: var(--gold); }
.input-group input { width: 76px; }
.input-group select { width: 100px; }

.btn-chart {
  background: linear-gradient(135deg, #2a2a1a 0%, #3a3525 100%);
  color: var(--gold); border: 1px solid var(--gold-dim);
  border-radius: 20px; padding: 0.5rem 1.6rem; font-size: 0.95rem;
  cursor: pointer; font-family: inherit; letter-spacing: 0.08em;
  transition: all 0.3s var(--ease); white-space: nowrap;
}
.btn-chart:hover {
  background: linear-gradient(135deg, #3a3525 0%, #4a4530 100%);
  border-color: var(--gold); box-shadow: 0 0 24px var(--gold-faint);
  transform: translateY(-1px);
}
.btn-chart:active { transform: translateY(0); }

/* ===== Info ===== */
.info-panel {
  display: none; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem 1.6rem; margin-bottom: 1.2rem;
}
.info-row {
  display: flex; align-items: center; gap: 0.8rem; padding: 0.3rem 0;
  font-size: 0.9rem;
}
.info-label {
  color: var(--gold); font-weight: 600; min-width: 3.5em;
  letter-spacing: 0.08em; font-family: "Noto Sans SC", sans-serif;
}
.bazi em {
  font-style: normal; margin-right: 0.3rem; color: var(--gold-dim); font-size: 1rem;
}
.sihua-lu { color: var(--sihua-lu); }
.sihua-quan { color: var(--sihua-quan); }
.sihua-ke { color: var(--sihua-ke); }
.sihua-ji { color: var(--sihua-ji); }

/* ===== Chart Grid ===== */
.chart-container { display: none; margin: 1.2rem 0; }
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 3px;
  max-width: 580px; margin: 0 auto;
}

.chart-cell {
  background: var(--bg-cell); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.5rem 0.45rem; min-height: 80px;
  cursor: pointer; transition: all 0.2s var(--ease);
  display: flex; flex-direction: column; gap: 0.15rem;
  position: relative; overflow: hidden;
}
.chart-cell:hover {
  border-color: var(--gold-dim); background: #1a1a28;
  transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.chart-cell.chart-ming {
  border-color: var(--gold-faint); background: #1a1a18;
}
.chart-empty { background: transparent; border: none; cursor: default; }
.chart-empty:hover { transform: none; box-shadow: none; }

.cell-header { display: flex; justify-content: space-between; align-items: center; }
.cell-name {
  font-size: 0.72rem; color: var(--text-dim); letter-spacing: 0.04em;
  font-family: "Noto Sans SC", sans-serif;
}
.chart-ming .cell-name { color: var(--gold); font-weight: 600; }
.cell-dizhi { font-size: 0.65rem; color: var(--text-muted); }

.cell-stars { display: flex; flex-wrap: wrap; gap: 1px 4px; }
.star { font-size: 0.7rem; line-height: 1.3; }
.main-star { color: var(--star-main); }
.aux-star { color: var(--star-aux); font-size: 0.64rem; }

.cell-daxian {
  font-size: 0.6rem; color: var(--text-muted); margin-top: auto;
}

/* ===== Detail ===== */
.detail-panel { display: none; margin-top: 1.2rem; }
.detail-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.3rem 1.6rem;
}
.detail-title {
  font-size: 1.05rem; color: var(--gold); letter-spacing: 0.08em;
  margin-bottom: 0.8rem; padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.detail-dizhi { color: var(--text-dim); font-size: 0.82rem; margin-left: 0.4rem; }
.detail-section { margin: 0.5rem 0; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.detail-label {
  color: var(--text-dim); font-size: 0.74rem; min-width: 3em;
  font-family: "Noto Sans SC", sans-serif;
}
.star-tag {
  display: inline-block; padding: 0.15em 0.5em; border-radius: 4px;
  font-size: 0.76rem; font-family: "Noto Sans SC", sans-serif;
}
.star-tag.main { background: #2a2a1a; color: var(--star-main); border: 1px solid #3a3a2a; }
.star-tag.aux { background: #1a1a24; color: var(--star-aux); border: 1px solid #2a2a36; }
.star-tag.sihua-lu { background: #1a2a1a; color: var(--sihua-lu); border: 1px solid #2a3a2a; }
.star-tag.sihua-quan { background: #2a2a1a; color: var(--sihua-quan); border: 1px solid #3a3a2a; }
.star-tag.sihua-ke { background: #1a1a2a; color: var(--sihua-ke); border: 1px solid #2a2a3a; }
.star-tag.sihua-ji { background: #2a1a1a; color: var(--sihua-ji); border: 1px solid #3a2a2a; }

/* ===== AI Button ===== */
.btn-ai {
  background: linear-gradient(135deg, #1a2a2a, #1e2e2e);
  color: #6ebfbf; border: 1px solid #6ebfbf33;
  border-radius: 20px; padding: 0.45rem 1.2rem;
  font-size: 0.84rem; cursor: pointer;
  font-family: inherit; letter-spacing: 0.05em;
  transition: all 0.3s var(--ease);
}
.btn-ai:disabled {
  background: var(--bg-deep); color: var(--text-dim);
  border-color: var(--border); cursor: not-allowed;
  border-radius: 20px;
}
.btn-ai:not(:disabled):hover {
  border-color: #6ebfbf; box-shadow: 0 0 20px rgba(110,191,191,0.12);
  transform: translateY(-1px);
}
#ai-result { margin-top: 1rem; }
.ai-text {
  white-space: pre-wrap; line-height: 1.8; font-size: 0.88rem;
  color: var(--text); margin-top: 0.5rem;
}

/* ===== Footer ===== */
.app-footer {
  text-align: center; padding: 3rem 0 1rem;
  font-size: 0.74rem; color: var(--text-muted);
  font-family: "Noto Sans SC", sans-serif; letter-spacing: 0.08em;
}
.app-footer a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.app-footer a:hover { color: var(--gold-dim); }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .app-wrapper { padding: 1.2rem 0.6rem 3rem; }
  .app-header { padding: 0.8rem 0 0.5rem; }
  .app-header .emblem { font-size: 2rem; }
  .app-header h1 { font-size: 1.45rem; letter-spacing: 0.2em; }
  .app-header .subtitle { font-size: 0.76rem; }
  .input-panel { padding: 1rem 0.9rem; margin: 0.8rem 0; }
  .input-row { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .input-group input,
  .input-group select { width: 100%; padding: 0.6rem 0.7rem; font-size: 1rem; }
  .input-group label { font-size: 0.7rem; }
  .btn-chart { padding: 0.6rem; font-size: 1rem; text-align: center; }
  .info-panel { padding: 1rem 0.9rem; }
  .info-row { font-size: 0.82rem; gap: 0.4rem; }
  .chart-grid { max-width: 100%; gap: 2px; }
  .chart-cell { padding: 0.3rem 0.25rem; min-height: 60px; }
  .cell-name { font-size: 0.6rem; }
  .cell-dizhi { font-size: 0.58rem; }
  .star { font-size: 0.58rem; }
  .aux-star { font-size: 0.54rem; }
  .detail-card { padding: 1rem 0.9rem; }
  .detail-title { font-size: 0.9rem; }
  .app-footer { padding: 2rem 0 0.8rem; font-size: 0.68rem; }
}

@media (max-width: 380px) {
  .app-header h1 { font-size: 1.2rem; }
  .chart-cell { padding: 0.25rem 0.2rem; min-height: 52px; }
  .cell-name { font-size: 0.54rem; }
  .star { font-size: 0.52rem; }
  .btn-chart { font-size: 0.9rem; }
}
