/* ── 曜室排盤 style.css v2 ─ 設計語言沿用詳批報告（核心/templates/report.css）：
      宣紙、墨綠、松綠標題、金眉標、陶土強調、宋體、金色八芒星、層疊水彩帶 ── */
:root {
  --ink: #23332d;
  --pine: #31594d;
  --pine-deep: #1f4138;
  --muted: #6f746e;
  --quiet: #8a8b82;
  --gold: #b88b3f;
  --gold-soft: #d7c29a;
  --clay: #a65f4c;
  --line: rgba(93, 96, 86, 0.30);
  --paper: #f5f0e6;
  --card: rgba(249, 244, 231, 0.5);
  --body-tag: #7a5c8a;
  /* 五行點綴（沿用報告四化章的色系） */
  --wx-木: #4f7f5e; --wx-火: #a6503f; --wx-土: #b8763f; --wx-金: #8a8b82; --wx-水: #4a6b8a;
  --serif: "Songti TC", "Noto Serif TC", "Hiragino Mincho ProN", serif;
  --sans: "PingFang TC", "Noto Sans TC", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.85;
  letter-spacing: .02em;
  overflow-x: hidden;
}
/* 宣紙：報告同一張底圖（乾淨.jpg 調暖加紋版）＋一層細紋 */
.paper-bg {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: url("/static/paper.jpg") center / cover no-repeat;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='190' height='190'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3'/%3E%3C/filter%3E%3Crect width='190' height='190' filter='url(%23n)' opacity='.085'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
/* 卡片自帶宣紙纖維紋（卡越白，紋越要自己長在卡上） */
.share-card, .trait, .special-box, .cell, .center, .promo {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.5 .58' numOctaves='3' seed='4'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23p)' opacity='.075'/%3E%3C/svg%3E");
}

p, .hint, .fineprint, .chart-note, .grid-note { text-wrap: pretty; }
h1, h2, h3, .t-hook, .share-card .hook { text-wrap: balance; }
.teaser { text-wrap: pretty; }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 20px; position: relative; }

/* ── 品牌列（照封面：曜室字標＋金色細線） ── */
.brand { padding: 26px 0 0; }
.brand .mark {
  font-family: var(--serif); font-size: 17px; font-weight: 700;
  letter-spacing: .55em; color: var(--pine-deep);
}
.brand .rule { width: 44px; height: 2px; background: var(--gold); margin-top: 8px; }

/* ── 封面水彩帶（報告封面.jpg 右側裁圖；貼齊視窗右緣） ── */
.page-art {
  position: fixed; top: 0; right: 0; z-index: 0; pointer-events: none;
  will-change: opacity;
  width: min(56vw, 430px); height: min(172vw, 900px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 5%, #000 76%, transparent 98%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 5%, #000 76%, transparent 98%);
}
.page-art img {
  width: 100%; height: 100%; object-fit: cover; object-position: right top; display: block;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 20%);
  mask-image: linear-gradient(to right, transparent 0, #000 20%);
}
.page-art .ta { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; }
@media (min-width: 900px) { .page-art { width: 400px; height: 900px; } }
.page-art { transition: opacity .7s ease; }
body:not(.view-hero) .page-art { opacity: 0 !important; }

/* 八芒星：緩慢呼吸（只動透明度；動 transform 會蓋掉定位） */
.tw { animation: twinkle 4.6s ease-in-out infinite; }
.tw2 { animation: twinkle 6.2s ease-in-out 1.4s infinite; }
@keyframes twinkle { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .tw, .tw2 { animation: none; } }

/* ── Hero ── */
#hero { padding: 8vh 0 56px; position: relative; }
.hero-text { position: relative; z-index: 1; }
h1 {
  font-family: var(--serif); font-weight: 900; font-size: clamp(34px, 9vw, 50px);
  line-height: 1.3; letter-spacing: .06em; color: var(--pine-deep); margin: 40px 0 12px;
}
h1 em { font-style: normal; color: var(--gold); }
.sub { color: var(--muted); font-size: 15.5px; letter-spacing: .12em; margin-bottom: 42px; max-width: 15em; }

/* ── 表單 ── */
form { display: grid; gap: 17px; max-width: 430px; position: relative; z-index: 1; }
.field label { display: block; font-size: 13.5px; letter-spacing: .14em; color: var(--pine); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--quiet); margin-top: 4px; }
input[type="text"], input[type="date"], input[type="time"], select {
  width: 100%; padding: 14px 15px; font-size: 17px; font-family: var(--serif);
  font-weight: 700; letter-spacing: .04em;
  color: var(--pine-deep); background: #fffdf6;
  border: 1px solid var(--line); border-radius: 8px;
  box-shadow: inset 0 1px 3px rgba(93, 96, 86, .07);
  -webkit-appearance: none; appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%23b88b3f' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center;
}
select:invalid { color: var(--quiet); font-family: var(--sans); font-weight: 400; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { opacity: .45; }
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.radio-row { display: flex; gap: 10px; }
.radio-row input { position: absolute; opacity: 0; pointer-events: none; }
.radio-row label {
  flex: 1; text-align: center; padding: 13px; border: 1px solid var(--line);
  border-radius: 8px; background: #fffdf6; cursor: pointer; font-size: 16px; margin: 0;
  box-shadow: inset 0 1px 3px rgba(93, 96, 86, .07);
}
.radio-row input:checked + label { background: var(--pine-deep); color: var(--paper); border-color: var(--pine-deep); }
.hp { position: absolute; left: -9999px; opacity: 0; }
button.go {
  margin-top: 10px; padding: 15px; font-size: 16.5px; font-family: var(--serif); font-weight: 700;
  letter-spacing: .4em; text-indent: .4em; color: var(--paper);
  background: var(--pine-deep); border: 0; border-radius: 6px; cursor: pointer;
}
button.go:active { transform: translateY(1px); }
button.go:disabled { opacity: .55; cursor: wait; }
.fineprint { font-size: 12px; color: var(--quiet); line-height: 1.7; }
.error-msg { color: var(--clay); font-size: 14px; display: none; }

/* ── 排盤中：星軌環繞（三圈金環、星體各繞各的、中心細芒星呼吸） ── */
#loading { text-align: center; padding: 14vh 0 19vh; }
#loading .orbits { width: 190px; height: 190px; margin: 0 auto 24px; display: block; }
#loading .orbits .orb { transform-origin: 95px 95px; }
#loading .orbits .o1 { animation: orbitspin 9s linear infinite; }
#loading .orbits .o2 { animation: orbitspin 15s linear infinite reverse; }
#loading .orbits .o3 { animation: orbitspin 6.5s linear infinite; }
#loading .orbits .r-out { animation: orbitspin 40s linear infinite; transform-origin: 95px 95px; }
@keyframes orbitspin { to { transform: rotate(360deg); } }
#loading .orbits .core { animation: breathe 3.6s ease-in-out infinite; transform-origin: 95px 95px; }
@keyframes breathe { 50% { transform: scale(1.12); opacity: .82; } }
@media (prefers-reduced-motion: reduce) {
  #loading .orbits .orb, #loading .orbits .core, #loading .orbits .r-out { animation: none; }
}
/* ── 眉標（照報告：小字金松綠＋細線＋宋體大標） ── */
.eyebrow-row { display: flex; align-items: center; gap: 12px; margin: 78px 0 6px; }
.eyebrow {
  font-family: var(--serif); font-size: 13.5px; font-weight: 700;
  letter-spacing: .5em; color: var(--gold); white-space: nowrap;
}
.eyebrow-row .rule { flex: 1; height: 1px; background: var(--line); }
.sec-title {
  font-family: var(--serif); font-weight: 900; font-size: 29px;
  letter-spacing: .08em; color: var(--pine-deep); margin-bottom: 24px;
}
.sec-note { font-size: 13px; color: var(--muted); margin: -14px 0 22px; text-wrap: pretty; }

/* ── 分享卡 ── */
.share-card {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 38px 26px 26px; margin-top: 44px; text-align: center;
  overflow: hidden;
}
.share-card .corner-star { position: absolute; top: 18px; right: 18px; width: 26px; height: 26px; }
.share-card .who { font-size: 13px; letter-spacing: .3em; color: var(--muted); }
.share-card .star-name.duo { font-size: clamp(30px, 8.2vw, 46px); letter-spacing: .1em; white-space: nowrap; }
.share-card .star-name {
  font-family: var(--serif); font-weight: 900; font-size: clamp(50px, 14vw, 76px);
  line-height: 1.2; letter-spacing: .08em; color: var(--pine-deep); margin: 10px 0 2px;
}
.share-card .kw { color: var(--gold); font-family: var(--serif); font-size: 16px; font-weight: 700; letter-spacing: .32em; }
.share-card .hook {
  font-family: var(--serif); font-size: 19px; font-weight: 700; color: var(--pine-deep);
  margin: 20px auto 0; max-width: 19em; line-height: 1.9;
}
.share-card .note { font-size: 12.5px; color: var(--muted); margin-top: 12px; line-height: 1.7; }
.share-card .quote {
  font-family: var(--serif); font-size: 16.5px; color: var(--ink);
  margin: 22px auto 0; max-width: 21em; line-height: 1.95;
}
.share-card .facts { display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; margin-top: 20px; }
.share-card .facts span {
  font-size: 12px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 99px; padding: 2px 11px;
}
.share-card .tag {
  margin-top: 24px; padding-top: 15px; border-top: 1px solid var(--line);
  font-size: 12px; letter-spacing: .26em; color: var(--quiet);
}
.share-card .tag b { color: var(--gold); font-weight: 700; }

/* ── 命盤 4×4（正規排法：外圈十二宮、中宮個資＋八字；照報告命盤頁） ── */
.chart {
  display: grid; gap: 5px; margin-top: 6px;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, minmax(88px, auto));
}
.cell {
  background: rgba(250, 245, 231, .58); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 7px 5px; position: relative; display: flex; flex-direction: column;
  min-width: 0;
}
.cell .stars {
  font-family: var(--serif); font-weight: 700; font-size: 14px; line-height: 1.4;
  letter-spacing: .04em; color: var(--ink);
}
.cell.has-tag .stars { padding-right: 34px; }
.cell .stars .mut {
  display: inline-block; font-style: normal; font-family: var(--sans);
  font-size: 8.5px; line-height: 1.5; color: #fff; border-radius: 3px;
  padding: 0 3px; margin-left: 2px; vertical-align: 2px; letter-spacing: 0;
}
.mut-祿 { background: #4f7f5e; } .mut-權 { background: #b8763f; }
.mut-科 { background: #4a6b8a; } .mut-忌 { background: #a6503f; }
.cell .minor {
  font-size: 9.5px; color: var(--quiet); line-height: 1.6; margin-top: 2px;
  letter-spacing: 0; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.cell .foot .age { display: none; }
@media (min-width: 560px) {
  .cell .foot .age { display: inline; font-size: 8.5px; color: var(--quiet); flex: 1; margin-left: 3px; letter-spacing: 0; }
}
.cell .stars.empty { color: var(--quiet); font-weight: 400; }
.cell .borrow { font-size: 10.5px; color: var(--quiet); line-height: 1.5; margin-top: 1px; }
.cell .foot {
  margin-top: auto; display: flex; justify-content: space-between; align-items: baseline;
  gap: 2px; flex-wrap: nowrap; white-space: nowrap;
}
.cell .pname { font-size: 10.5px; font-weight: 600; color: var(--pine); letter-spacing: 0; }
.cell .gz { font-size: 9.5px; color: var(--quiet); letter-spacing: 0; }
.cell .tag {
  position: absolute; top: 5px; right: 5px; font-size: 8.5px; letter-spacing: .1em;
  color: #fff; border-radius: 3px; padding: 1px 4px; line-height: 1.5;
}
.cell .tag.life { background: #3e6b58; }
.cell .tag.body { background: var(--body-tag); }
.cell.is-life { border-color: rgba(49, 89, 77, .55); background: rgba(252, 248, 238, .72); }
.cell.is-body { border-color: rgba(122, 92, 138, .45); background: rgba(252, 248, 238, .66); }
.cell.hl { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184, 139, 63, .35); }

/* 中宮：個資＋八字 */
.center {
  grid-column: 2 / 4; grid-row: 2 / 4;
  background: rgba(250, 245, 231, .68); border: 1px solid var(--gold-soft); border-radius: 6px;
  padding: 12px 12px 10px; display: flex; flex-direction: column; justify-content: space-between;
}
.center .ct {
  font-family: var(--serif); font-weight: 900; font-size: 16.5px; text-align: center;
  letter-spacing: .3em; text-indent: .3em; color: var(--pine-deep); margin-bottom: 6px;
}
.center .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 11.5px; line-height: 1.9; }
.center .row .k { color: var(--quiet); letter-spacing: .18em; white-space: nowrap; }
.center .row .v { color: var(--ink); font-weight: 600; text-align: right; }
.center .bz { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.center .bz .p { text-align: center; }
.center .bz .pl { font-size: 9.5px; color: var(--quiet); letter-spacing: .15em; }
.center .bz .pg { font-family: var(--serif); font-weight: 700; font-size: 15px; color: var(--ink); letter-spacing: .06em; }
.center .bz .p.day .pg { color: var(--gold); }
.center .bz .ps { font-size: 9.5px; color: var(--pine); margin-top: 1px; }
.center .bz .p.day .ps { color: var(--gold); font-weight: 700; }
.center .bz .pn2 { font-size: 9px; color: var(--quiet); letter-spacing: 0; }
.chart-note { font-size: 12.5px; color: var(--quiet); margin-top: 14px; line-height: 1.8; }

/* ── 三段個性 ── */
.trait {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 22px 24px 20px; margin-bottom: 14px;
  position: relative; overflow: hidden;
}
.trait .wm {
  position: absolute; top: 16px; right: 12px; pointer-events: none;
  writing-mode: vertical-rl; font-family: var(--serif); font-weight: 900;
  font-size: 46px; letter-spacing: .14em; line-height: 1;
  color: rgba(49, 89, 77, .09); user-select: none;
}
.trait > p, .trait h3 { position: relative; }
.trait .t-label { font-size: 12px; letter-spacing: .3em; color: var(--gold); font-family: var(--serif); font-weight: 700; }
.trait h3 { font-family: var(--serif); font-size: 23px; font-weight: 900; color: var(--pine-deep); margin: 5px 0 2px; letter-spacing: .05em; }
.trait .t-sub { font-size: 13px; color: var(--muted); letter-spacing: .06em; margin-bottom: 4px; }
.trait .t-hook {
  font-family: var(--serif); font-weight: 700; font-size: 17.5px; color: var(--pine);
  line-height: 1.9; margin: 10px 0 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.trait p { font-size: 15.5px; margin-bottom: 11px; color: var(--ink); }
.trait p b.lead { font-family: var(--serif); color: var(--pine); }
.trait .close { font-family: var(--serif); font-size: 16px; color: var(--clay); margin-top: 2px; }

/* ── 產品區 ── */
.teaser {
  font-family: var(--serif); font-size: 17.5px; line-height: 2.1; color: var(--ink);
  margin-bottom: 24px; max-width: 27em;
}
.product { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 15px 2px; border-bottom: 1px solid var(--line); }
.product .pn { font-family: var(--serif); font-weight: 700; font-size: 18px; color: var(--pine-deep); letter-spacing: .06em; }
.product .pd { font-size: 13px; color: var(--muted); margin-top: 1px; }
.product .pp { font-family: var(--serif); font-size: 17px; color: var(--gold); white-space: nowrap; }
.promo {
  margin-top: 26px; padding: 18px 20px 16px; text-align: center;
  border: 1.5px dashed var(--gold-soft); border-radius: 10px;
  background: rgba(249, 244, 231, .5);
}
.promo .promo-head { font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--pine-deep); }
.promo .promo-head b { color: var(--clay); }
.promo .promo-sub { font-size: 12.5px; color: var(--muted); margin: 3px 0 12px; }
.promo .line-btn {
  display: inline-block; padding: 11px 26px; border-radius: 99px;
  background: var(--gold); color: #fffdf6; font-size: 14.5px; letter-spacing: .2em; text-indent: .2em;
}
.cta-row { display: grid; gap: 11px; margin-top: 16px; }
.cta {
  display: block; text-align: center; padding: 15px; border-radius: 6px; text-decoration: none;
  font-family: var(--serif); font-weight: 700; font-size: 15.5px; letter-spacing: .28em; text-indent: .28em;
}
.cta.primary { background: var(--pine-deep); color: var(--paper); }
.cta.secondary { border: 1.5px solid var(--pine); color: var(--pine); }
.cta.ghost { color: var(--quiet); font-size: 12.5px; border: 0; background: none; cursor: pointer; font-family: var(--sans); letter-spacing: .12em; }

/* ── 特殊盤 ── */
.special-box { background: var(--card); border: 1px solid var(--gold); border-radius: 8px; padding: 28px 24px; margin-top: 40px; }
.special-box h3 { font-family: var(--serif); font-size: 19px; font-weight: 900; color: var(--pine-deep); margin-bottom: 10px; }
.special-box p { font-size: 14px; margin-bottom: 16px; }

/* ── 頁尾 ── */
footer { margin-top: 84px; padding: 26px 0 44px; border-top: 1px solid var(--line); }
footer .foot-brand { font-family: var(--serif); font-weight: 700; font-size: 15px; letter-spacing: .5em; color: var(--pine-deep); margin-bottom: 8px; }
footer p { font-size: 12px; color: var(--quiet); line-height: 1.9; }
footer a { color: var(--gold); }

/* ── 進場 ── */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .65s ease, transform .65s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
