/* ============================================================
   public/css/lunar.css — 生辰換算頁專屬樣式
   ------------------------------------------------------------
   沿用玄境的黑金主題（--gold / --serif），只補這一頁需要的元件：
   頁首、卡片、曆別頁籤、欄位、四柱盤、結果清單。
   行動優先：先寫手機能單手操作的尺寸，再把桌機放寬。
   ============================================================ */

.lunar-wrap {
  max-width: 780px;
  padding-top: 30px;
  padding-bottom: 56px;
}

/* ---------- 頁首 ---------- */
.ln-head { margin-bottom: 20px; }
.ln-kicker {
  margin: 0 0 4px;
  color: #c9a05e;
  font-size: 12.5px;
  letter-spacing: .28em;
}
.lunar-wrap h1 {
  font-family: var(--serif, "Noto Serif TC", serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: .1em;
  margin: 0 0 16px;
  padding-bottom: 13px;
  position: relative;
}
/* 短金線：與解夢、梅花、排盤、古籍頁同一個收尾語彙 */
.lunar-wrap h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, rgba(224, 196, 130, .9), rgba(224, 196, 130, .05));
}
.ln-sub {
  margin: 0;
  color: #a99c86;
  font-size: 14.5px;
  line-height: 1.95;
}
.ln-sub strong { color: #e0c482; font-weight: 600; }

/* ---------- 卡片 ---------- */
.ln-card {
  background: rgba(24, 17, 33, .72);
  border: 1px solid rgba(224, 196, 130, .18);
  border-radius: 16px;
  padding: 18px 18px 20px;
  margin-bottom: 16px;
}
.ln-card-title {
  font-family: var(--serif, "Noto Serif TC", serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .1em;
  color: #e0c482;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(224, 196, 130, .14);
}
.ln-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(224, 196, 130, .14);
  color: #d9bd76;
  font-size: 12px;
  vertical-align: 2px;
}

/* ---------- 提示條 ---------- */
.ln-flash {
  border-radius: 12px;
  padding: 12px 15px;
  margin-bottom: 16px;
  font-size: 14.5px;
  line-height: 1.75;
}
.ln-flash.ok  { background: rgba(159, 230, 189, .09); border: 1px solid rgba(130, 220, 170, .28); color: #b7e7cb; }
.ln-flash.bad { background: rgba(255, 150, 150, .08); border: 1px solid rgba(255, 150, 150, .3);  color: #ffc0c0; }

/* ---------- 會員：系統記著的生辰 ---------- */
.ln-saved {
  border-color: rgba(224, 196, 130, .38);
  background: linear-gradient(150deg, rgba(46, 35, 22, .82), rgba(24, 17, 33, .8));
}
.ln-saved-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.ln-saved-head h2 {
  font-family: var(--serif, "Noto Serif TC", serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .1em;
  color: #f4dfa4;
  margin: 0;
}
.ln-chip {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(224, 196, 130, .35);
  color: #d9bd76;
  font-size: 12px;
  white-space: nowrap;
}

/* 國曆／農曆並排的識別區 */
.ln-identity {
  display: grid;
  gap: 10px;
  margin-bottom: 6px;
}
.ln-id-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.ln-id-label {
  flex: 0 0 auto;
  min-width: 3.2em;
  color: #a99c86;
  font-size: 13px;
  letter-spacing: .12em;
}
.ln-id-value {
  font-family: var(--serif, "Noto Serif TC", serif);
  color: #f4dfa4;
  font-size: 20px;
  letter-spacing: .04em;
  word-break: break-word;
}
.ln-id-week { color: #a99c86; font-size: 13.5px; }
/* 民國紀年：緊接在西元年之後，做為台灣使用者的對照 */
.ln-id-mguo {
  color: #c9a05e;
  font-size: 13.5px;
  letter-spacing: .04em;
  white-space: nowrap;
}

/* ---------- 曆別頁籤 ---------- */
.ln-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.ln-tab {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(224, 196, 130, .2);
  border-radius: 12px;
  background: rgba(0, 0, 0, .12);
  color: #a99c86;
  font-size: 14.5px;
  cursor: pointer;
}
.ln-tab input { position: absolute; opacity: 0; pointer-events: none; }
.ln-tab:has(input:checked) {
  background: linear-gradient(120deg, #f4dfa4, #c9a05e);
  border-color: transparent;
  color: #241b10;
  font-weight: 700;
}
/* :has() 不支援時的後備（以 sibling 方式無法處理，改用 JS 加 class 亦可） */
.ln-tab.on {
  background: linear-gradient(120deg, #f4dfa4, #c9a05e);
  border-color: transparent;
  color: #241b10;
  font-weight: 700;
}

/* ---------- 欄位 ---------- */
.ln-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ln-field { display: block; }
.ln-wide { grid-column: 1 / -1; }
.ln-label {
  display: block;
  margin-bottom: 6px;
  color: #a99c86;
  font-size: 13px;
  letter-spacing: .1em;
}
.ln-field input[type="number"],
.ln-field input[type="text"],
.ln-field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(224, 196, 130, .18);
  border-radius: 10px;
  background: rgba(0, 0, 0, .22);
  color: #efe6d5;
  font-size: 16px;              /* ≥16px：iOS 聚焦時才不會自動放大 */
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.ln-field select {
  background-image: linear-gradient(45deg, transparent 50%, #c9a05e 50%),
                    linear-gradient(135deg, #c9a05e 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
.ln-field input:focus,
.ln-field select:focus {
  outline: none;
  border-color: #c9a05e;
  box-shadow: 0 0 0 3px rgba(201, 160, 94, .16);
}
.ln-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 4px;
  color: #cbbfa8;
  font-size: 14.5px;
  cursor: pointer;
}
.ln-check input { width: 18px; height: 18px; accent-color: #c9a05e; }

.ln-note {
  margin: 10px 0 0;
  color: #8f8578;
  font-size: 13px;
  line-height: 1.85;
}
/* 民國年提示：緊跟在「年」輸入框下方，國曆模式下即時對照 */
.ln-field-hint {
  display: block;
  min-height: 1.2em;
  margin-top: 5px;
  color: #c9a05e;
  font-size: 12.5px;
  letter-spacing: .04em;
  white-space: nowrap;
}
.ln-note-end { margin-top: 14px; padding-top: 12px; border-top: 1px dashed rgba(224, 196, 130, .14); }
.ln-more { margin-top: 12px; }
.ln-more summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: #c9a05e;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.ln-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.ln-btn {
  flex: 1 1 150px;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 12px 24px;
  background: linear-gradient(120deg, #f4dfa4, #c9a05e);
  color: #241b10;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.ln-btn.ghost {
  background: transparent;
  border: 1px solid rgba(224, 196, 130, .4);
  color: #e0c482;
}
.ln-btn:active { transform: translateY(1px); }

.ln-cta {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed rgba(224, 196, 130, .14);
  color: #a99c86;
  font-size: 14px;
  line-height: 1.85;
}
.ln-cta a { color: #e0c482; text-decoration: none; border-bottom: 1px solid rgba(224, 196, 130, .4); }

/* ---------- 四柱盤 ---------- */
.ln-sec {
  font-family: var(--serif, "Noto Serif TC", serif);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: .14em;
  color: #c9a05e;
  margin: 22px 0 12px;
}
.ln-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.ln-pillar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 4px 10px;
  border: 1px solid rgba(224, 196, 130, .2);
  border-radius: 12px;
  background: rgba(0, 0, 0, .18);
}
.ln-pillar.empty { opacity: .55; }
.ln-pillar-name {
  color: #a99c86;
  font-size: 12px;
  letter-spacing: .12em;
  margin-bottom: 4px;
}
.ln-pillar-gan,
.ln-pillar-zhi {
  font-family: var(--serif, "Noto Serif TC", serif);
  font-size: 30px;
  line-height: 1.15;
  color: #f4dfa4;
}
.ln-pillar-zhi { color: #e0c482; }
.ln-pillar-unknown {
  font-family: var(--serif, "Noto Serif TC", serif);
  font-size: 19px;
  color: #6f675c;
  padding: 12px 0;
}
.ln-pillar-note {
  margin-top: 6px;
  color: #8f8578;
  font-size: 11.5px;
  text-align: center;
  line-height: 1.5;
  word-break: break-word;
}
.ln-rules {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #8f8578;
  font-size: 12.5px;
  line-height: 1.9;
}
.ln-rules strong { color: #c9a05e; }

/* ---------- 條列資料 ---------- */
.ln-kv { margin: 0; }
.ln-kv > div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(224, 196, 130, .1);
}
.ln-kv > div:last-child { border-bottom: 0; }
.ln-kv dt {
  flex: 0 0 auto;
  min-width: 7.5em;
  color: #a99c86;
  font-size: 13.5px;
}
.ln-kv dd { flex: 1 1 auto; margin: 0; color: #efe6d5; font-size: 14.5px; line-height: 1.8; }
.ln-kv dd strong { color: #f4dfa4; }
.ln-dim { color: #8f8578; font-size: 13px; }

/* ---------- 已存清單 ---------- */
.ln-list { list-style: none; margin: 0; padding: 0; }
.ln-list-item {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px dashed rgba(224, 196, 130, .12);
}
.ln-list-item:last-child { border-bottom: 0; }
.ln-list-item.is-default { background: rgba(224, 196, 130, .05); border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.ln-list-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 240px; }
.ln-list-name {
  font-family: var(--serif, "Noto Serif TC", serif);
  color: #f4dfa4;
  font-size: 16px;
  letter-spacing: .06em;
}
.ln-list-date { color: #cbbfa8; font-size: 13.5px; overflow-wrap: anywhere; }
.ln-list-sub { color: #8f8578; font-size: 12.5px; letter-spacing: .04em; }
.ln-list-ops { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ln-list-ops form { margin: 0; }
.ln-mini {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid rgba(224, 196, 130, .28);
  border-radius: 999px;
  background: transparent;
  color: #d9bd76;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.ln-mini.danger { border-color: rgba(255, 150, 150, .3); color: #ffb0b0; }
.ln-mini:active { transform: translateY(1px); }

.ln-inline-form { margin: 0; }

/* ---------- 桌機 ---------- */
@media (min-width: 769px) {
  .lunar-wrap { padding-top: 44px; }
  .lunar-wrap h1 { font-size: 34px; }
  .ln-card { padding: 24px 26px 26px; }
  .ln-identity { grid-template-columns: 1fr 1fr; gap: 6px 22px; }
  .ln-identity .ln-id-main:nth-child(3) { grid-column: 1 / -1; }
  .ln-id-value { font-size: 22px; }
  .ln-tabs { grid-template-columns: 220px 220px; }
  .ln-pillars { gap: 12px; }
  .ln-pillar-gan, .ln-pillar-zhi { font-size: 36px; }
}

/* ---------- 窄機（≤360px） ---------- */
@media (max-width: 360px) {
  .ln-pillars { grid-template-columns: repeat(2, 1fr); }
  .ln-grid { grid-template-columns: repeat(2, 1fr); }
  .ln-field:first-child { grid-column: 1 / -1; }
}
