/* ══════════════════════════════════════════════════════════════
   八字排盤 — 輸入卡與結果區共用樣式
   由 calculator.html 與首頁嵌入版共用（配合 assets/bazi.js）。
   ══════════════════════════════════════════════════════════════ */

.card {
  background: var(--white); border: 1px solid var(--light-gray); border-radius: 12px;
  padding: 24px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; color: var(--dark); letter-spacing: 1px; text-align: left; }
.input-row { display: flex; flex-direction: column; gap: 16px; }
.input-group { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.input-group label { font-size: 0.9rem; font-weight: 600; color: var(--mid-gray); letter-spacing: 0.1em; }
.input-group input, .input-group select {
  padding: 14px 16px; border: 1px solid var(--light-gray); border-radius: 10px;
  font-size: 1.05rem; color: var(--dark); background: var(--white);
  outline: none; transition: border-color .15s; width: 100%; -webkit-appearance: none; font-family: inherit;
}
.input-group input:focus, .input-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(155,92,112,.15); }
.input-group input[type="number"]::-webkit-inner-spin-button,
.input-group input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input-group input[type="number"] { -moz-appearance: textfield; }
.dob-row { display: grid; grid-template-columns: 90px 1fr 80px; gap: 8px; align-items: stretch; }
.dob-field { display: flex; flex-direction: column; gap: 4px; }
.dob-sub { font-size: 0.75rem !important; font-weight: 500 !important; letter-spacing: 0 !important; color: var(--mid-gray); }
@media (max-width: 480px) { .dob-row { grid-template-columns: 80px 1fr 70px; gap: 6px; } }
.btn {
  padding: 16px 28px; background: var(--accent); color: #fff; border: none; border-radius: 10px;
  font-size: 1.1rem; font-weight: 600; cursor: pointer; transition: background .15s, transform .1s;
  white-space: nowrap; width: 100%; letter-spacing: 0.15em; font-family: inherit;
}
.btn:hover { background: #874e62; }
.btn:active { transform: scale(.98); }

/* 四柱表 */
.pillars-table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 8px; border-radius: 12px; overflow: hidden; border: 1px solid var(--light-gray); table-layout: fixed; }
.pillars-table td { text-align: center; vertical-align: middle; padding: 14px 8px; }
.pt-label { width: 90px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; color: var(--mid-gray); text-align: left !important; padding-left: 14px !important; padding-right: 12px !important; background: var(--white); border-right: 1px solid var(--light-gray); }
.pt-data { width: calc((100% - 90px) / 4); }
.pt-header-row td { padding: 10px 8px; font-size: 0.95rem; font-weight: 700; letter-spacing: 0.1em; color: var(--mid-gray); background: var(--white); border-bottom: 1px solid var(--light-gray); }
.pt-stem-row td, .pt-branch-row td { padding: 18px 8px; background: #fff; border-bottom: 1px solid var(--light-gray); }
.pt-hidden-row td { padding: 14px 8px; background: #fff; vertical-align: top; }
.pt-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pt-cn { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.pt-sub { display: block; font-size: 0.75rem; font-weight: 500; color: var(--mid-gray); margin-top: 3px; letter-spacing: 0.05em; }
.pt-hidden-item { font-size: 0.85rem; font-weight: 600; padding: 3px 0; line-height: 1.5; }
.pt-gods-row td { padding: 10px 8px; background: var(--accent-light); border-bottom: 1px solid var(--light-gray); }
.pt-god-main { font-size: 0.95rem; font-weight: 600; color: var(--dark); line-height: 1.4; }
.pt-god-self { font-size: 0.95rem; font-weight: 700; color: var(--accent); }
.pt-subgods-row td { padding: 10px 8px; background: var(--white); vertical-align: top; border-bottom: 1px solid var(--light-gray); }
.pt-subgod-item { font-size: 0.82rem; font-weight: 500; padding: 2px 0; line-height: 1.5; color: var(--dark); }
.tc-wood { color: #3a8a4f; } .tc-fire { color: #c0392b; } .tc-earth { color: #92400e; } .tc-metal { color: #b8893a; } .tc-water { color: #2874a6; }

/* 日主 + 生肖並排 */
.dm-z-row { display: flex; gap: 16px; flex-wrap: wrap; }
.dm-z-row .card { flex: 1; min-width: 250px; display: flex; }
.dm-z-row .day-master-box, .dm-z-row .zodiac-card { flex: 1; margin-bottom: 0; }
.day-master-box { display: flex; flex-direction: row; align-items: center; justify-content: center; text-align: left; gap: 16px; padding: 22px 20px; border-radius: 12px; background: var(--accent-light); border: 1px solid rgba(155,92,112,.15); }
.dm-icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.dm-info .dm-label, .zodiac-info .z-label { font-size: 12px; font-weight: 700; letter-spacing: 3px; color: var(--accent-deep); margin-bottom: 3px; }
.dm-info h3 { font-size: clamp(1.5rem, 3.4vw, 2rem); font-weight: 800; letter-spacing: 1px; line-height: 1.15; color: var(--dark); }
.dm-info p { font-size: 0.92rem; color: var(--mid-gray); margin-top: 6px; line-height: 1.7; max-width: 460px; }
.zodiac-card { display: flex; flex-direction: row; align-items: center; justify-content: center; text-align: left; gap: 16px; padding: 22px 20px; border-radius: 12px; background: linear-gradient(135deg, var(--accent-light) 0%, var(--off-white) 100%); border: 1px solid rgba(155,92,112,.15); }
.zodiac-icon { font-size: 30px; flex-shrink: 0; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; background: var(--white); border-radius: 50%; box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.zodiac-info h3 { font-size: clamp(1.5rem, 3.4vw, 2rem); font-weight: 800; letter-spacing: 1px; line-height: 1.15; color: var(--dark); }

/* 五行 */
.elements-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.element-chip { flex: 1; min-width: 80px; text-align: center; padding: 12px 8px; border-radius: 10px; font-weight: 600; font-size: 0.95rem; }
.element-chip .count { font-size: 1.3rem; display: block; margin-bottom: 2px; }
.element-chip .elabel { font-size: 0.8rem; font-weight: 500; opacity: .85; }
.bar-chart { margin-top: 8px; }
.bar-row { display: flex; align-items: center; margin-bottom: 6px; gap: 8px; }
.bar-label { width: 52px; font-size: 0.88rem; font-weight: 500; text-align: right; color: var(--mid-gray); }
.bar-track { flex: 1; height: 22px; background: var(--white); border-radius: 6px; overflow: hidden; border: 1px solid var(--light-gray); }
.bar-fill { height: 100%; border-radius: 6px; transition: width .4s ease; }
.bar-val { width: 36px; font-size: 0.8rem; font-weight: 600; color: var(--mid-gray); }

/* 大運 / 流年 */
.luck-scroll { overflow-x: auto; padding-bottom: 8px; }
.luck-row { display: flex; gap: 8px; min-width: max-content; }
.luck-pill { text-align: center; width: 118px; flex: 0 0 118px; padding: 10px 10px 12px; border: 1px solid var(--light-gray); border-radius: 10px; background: var(--white); transition: box-shadow .15s; }
.luck-pill:hover { box-shadow: 0 10px 15px -3px rgba(0,0,0,.08); }
.luck-years { font-size: 0.78rem; font-weight: 600; color: var(--dark); margin-bottom: 2px; }
.luck-age { font-size: 0.72rem; color: var(--mid-gray); margin-bottom: 8px; font-weight: 500; }
.luck-chars { display: flex; gap: 6px; justify-content: center; }
.luck-cn { font-size: 1.35rem; font-weight: 700; padding: 3px 7px; border-radius: 6px; line-height: 1.3; }
.pill-gods { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--light-gray); }
.pill-god-row { padding: 2px 0; }
.pill-god-cn { font-size: 0.8rem; font-weight: 600; color: var(--dark); line-height: 1.4; }
.liunian-pill { position: relative; margin-top: 14px; }
.liunian-current { border: 2px solid var(--accent); box-shadow: 0 0 0 3px rgba(155,92,112,.12); }
.liunian-current::after { content: '今年'; position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: 0.62rem; font-weight: 700; padding: 1px 8px; border-radius: 8px; white-space: nowrap; letter-spacing: 0.1em; z-index: 1; }

/* 五行語義色 */
.el-wood { background: #ecf5ee; color: #2d6e3e; } .el-fire { background: #fbe9e7; color: #c0392b; }
.el-earth { background: #fef3e2; color: #92400e; } .el-metal { background: #fdf6e3; color: #8a6d00; }
.el-water { background: #e8f0f8; color: #1a5276; }
.bar-wood { background: #3a8a4f; } .bar-fire { background: #c0392b; } .bar-earth { background: #92400e; }
.bar-metal { background: #b8893a; } .bar-water { background: #2874a6; }
.dm-wood { background: #3a8a4f; } .dm-fire { background: #c0392b; } .dm-earth { background: #92400e; }
.dm-metal { background: #b8893a; } .dm-water { background: #2874a6; }

#results { display: none; }
.calc-note { font-size: 0.82rem; color: var(--mid-gray); text-align: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--light-gray); line-height: 1.8; }
.share-btn { display: inline-block; font-size: 14px; font-weight: 600; color: var(--dark); background: transparent; border: 1.5px solid rgba(75,44,63,0.25); padding: 11px 26px; border-radius: 980px; cursor: pointer; font-family: inherit; }

/* ── 列印命盤：Email 彈窗 ── */
.chart-modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(46,20,36,0.5);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.chart-modal {
  background: var(--white); border-radius: var(--radius);
  max-width: 420px; width: 100%; padding: 34px 30px 30px; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3); position: relative;
}
.chart-modal .cm-close {
  position: absolute; top: 12px; right: 16px; background: none; border: none;
  font-size: 24px; color: var(--mid-gray); cursor: pointer; line-height: 1; font-family: inherit;
}
.chart-modal .cm-emoji { font-size: 34px; font-weight: 700; color: var(--accent-deep); margin-bottom: 10px; }
.chart-modal h3 { font-size: 20px; font-weight: 700; color: var(--dark); letter-spacing: 1px; margin-bottom: 10px; }
.chart-modal p { font-size: 14px; color: var(--mid-gray); line-height: 1.9; margin-bottom: 18px; }
.chart-modal input[type="email"] {
  width: 100%; padding: 13px 15px; border: 1px solid var(--light-gray); border-radius: 10px;
  font-size: 1rem; color: var(--dark); background: var(--white); outline: none; font-family: inherit;
  margin-bottom: 12px; -webkit-appearance: none;
}
.chart-modal input[type="email"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(155,92,112,.15); }
.chart-modal .cm-error { color: #c0392b; font-size: 13px; margin: -6px 0 10px; display: none; }

/* ── 列印樣式：只印命盤結果 ── */
.print-brand { display: none; }
@media print {
  nav, footer, .mobile-nav-overlay, .hero, #reading-promo, #about, #guide,
  .calc-input-card, .chart-actions-card, .reading-cta-card,
  .heading-row, .section-eyebrow, .section-title, .section-sub,
  .chart-modal-overlay { display: none !important; }
  body { background: #fff !important; }
  section { padding: 0 !important; }
  #results { display: block !important; }
  .print-brand {
    display: block; text-align: center; font-size: 13px; font-weight: 700;
    letter-spacing: 3px; color: var(--dark); margin-bottom: 14px;
    padding-bottom: 10px; border-bottom: 2px solid var(--dark);
  }
  .card { box-shadow: none !important; break-inside: avoid; margin-bottom: 12px; padding: 14px 16px; }
  .dm-info p { font-size: 0.8rem; }
  .luck-scroll { overflow: visible !important; }
  .luck-row { flex-wrap: wrap; min-width: 0 !important; }
  .luck-pill { break-inside: avoid; }
  .pillars-table-wrap { overflow: visible !important; margin: 0 !important; padding: 0 !important; }
  .calc-note { page-break-inside: avoid; }
}

/* 手機：四柱表橫向捲動 */
@media (max-width: 768px) {
  .pillars-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -12px; padding: 0 12px; }
  .pillars-table { min-width: 480px; font-size: 0.85rem; }
  .pt-label { width: 70px; font-size: 0.72rem; padding-left: 10px !important; padding-right: 8px !important; }
  .pt-cn { font-size: 1.25rem; }
  .pt-hidden-item { font-size: 0.72rem; }
  .pt-god-main { font-size: 0.8rem; }
  .pt-subgod-item { font-size: 0.72rem; }
}
