/* 首頁：星盤＋今日一張牌（定案示意 dev/design-options/home-ab-hybrid.html） */

/* ---------- 牌（共用） ---------- */
.card { width: 154px; height: 264px; perspective: 1200px; flex: none; }
.tilt { width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .25s ease-out; }
.card-in { display: block; position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .8s var(--ease); }
.card.down .card-in { transform: rotateY(180deg); }

/* ---------- Hero ---------- */
.hero { max-width: var(--page); margin: 0 auto; padding: 1.5rem 1.5rem 4rem;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 3rem; align-items: center; }
.hero h1 { font-size: 2.7rem; font-weight: 900; line-height: 1.35; margin: 0 0 .8rem; letter-spacing: .04em; }
.hero h1 span { white-space: nowrap; }
.lead { color: var(--mist); font-size: 1.08rem; margin: 0 0 1.8rem; max-width: 26em; }

.picked { display: flex; gap: 1.6rem; align-items: center; min-height: 270px; }
.picked .card.out .tilt { animation: fly-out .45s ease-in forwards; }
.picked .card.in .tilt { animation: deal-in .6s var(--ease) both; }
@keyframes fly-out { to { transform: translate(-60px, -30px) rotate(-14deg); opacity: 0; } }
@keyframes deal-in { from { transform: translate(260px, -60px) rotate(18deg); opacity: 0; } }
.picked-text h2 { margin: 0; font-size: 1.7rem; font-weight: 900; color: var(--gold-pale); letter-spacing: .08em; }
.picked-text p { margin: .3rem 0 1.1rem; max-width: 16em; }
.picked-text.swap > * { animation: rise .55s ease both; }
.picked-text.swap > :nth-child(2) { animation-delay: .06s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.ask { margin-top: 1.6rem; }
.ask h3 { margin: 0 0 .5rem; font-size: 1rem; font-weight: 400; color: var(--mist); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { font: inherit; font-size: .95rem; color: var(--star); background: rgba(58,46,143,.45); border: 1px solid rgba(239,197,111,.45);
  border-radius: 999px; padding: .2rem 1rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--gold); color: var(--night); border-color: var(--gold); }
.suggest { margin: .6rem 0 0; min-height: 1.9em; color: var(--gold-pale); font-size: .98rem; }

/* 星盤 */
.dial-col { min-width: 0; }
.dial-wrap { position: relative; width: min(560px, 100%); aspect-ratio: 1; margin: 0 auto; }
.dial-wrap > svg { width: 100%; height: 100%; overflow: visible; }
.pointer { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); width: 0; height: 0;
  border-left: 11px solid transparent; border-right: 11px solid transparent; border-top: 18px solid var(--gold);
  filter: drop-shadow(0 0 6px rgba(239,197,111,.8)); z-index: 2; }
.hub { --ink: url(#fc-line); --hole: #2C2268; position: absolute; left: 50%; top: 50%; width: 30.667%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; display: grid; place-items: center; pointer-events: none;
  background: radial-gradient(circle at 50% 40%, #4B3AA6, #241A5C 75%); box-shadow: 0 0 0 2px var(--gold), 0 0 40px rgba(139,58,142,.8); }
.hub svg { width: 58%; height: auto; }
.hub.swap svg { animation: pop .7s cubic-bezier(.2,.8,.2,1.2) both; }
@keyframes pop { from { opacity: 0; transform: scale(.6) rotate(-20deg); } }
.zodiac { transform-origin: 0 0; animation: spin 240s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.dial { transform-origin: 0 0; transition: transform 1.4s var(--ease); }
.sector { cursor: pointer; outline: none; transition: opacity .4s; }
/* 亮度：剛進頁面全亮；讀者點過之後（.chosen）選中的＝全亮、沒選的＝半暗；推薦模式下推薦的＝全亮、不相關的＝更暗 */
.dial.chosen .sector:not(.on) { opacity: .45; }
.dial.chosen .sector.match:not(.on) { opacity: 1; }
.dial.chosen .sector.dim:not(.on) { opacity: .25; }
.dial.chosen .sector:not(.on):focus-visible { opacity: 1; }
.sector path { fill: rgba(58,46,143,.25); transition: fill .3s; }
.sector.on path { fill: rgba(239,197,111,.18); }
.sector.match path { fill: rgba(139,58,142,.45); }
@media (hover: hover) { .dial.chosen .sector:not(.on):hover { opacity: .85; } .sector:hover path { fill: rgba(139,58,142,.4); } }
.sector:focus-visible path { stroke: var(--gold); stroke-width: 2; }
.sector text { fill: var(--star); font-family: var(--serif); font-weight: 700; font-size: 19px; letter-spacing: 1px; }
.sector.on text { fill: var(--gold-pale); }
@media (hover: none) { .kbd-hint { display: none; } } /* 手機沒有 Tab 鍵 */
.lab { transition: transform 1.4s var(--ease); }
.tri line { stroke: var(--gold); stroke-width: 5; stroke-linecap: round; }
.hint { position: absolute; bottom: -2.2rem; left: 0; right: 0; text-align: center; color: var(--mist); font-size: .85rem; margin: 0; }

/* ---------- 今日一張牌：發牌扇形 ---------- */
.daily { position: relative; max-width: var(--page); margin: 0 auto; padding: 4rem 1.5rem 5rem; text-align: center; }
.daily > :not(.dipper) { position: relative; }
/* 北斗七星＋北極星（紫微星）：固定畫在這區左側的背景 */
.dipper { position: absolute; left: 1.5rem; top: 1.5rem; width: 190px; height: 330px; pointer-events: none; overflow: visible; }
.dipper line { stroke: #FBE6B0; stroke-width: 1; opacity: .42; stroke-dasharray: var(--len); stroke-dashoffset: var(--len); }
.dipper .pointer-line { stroke-dasharray: 2 6; opacity: .32; stroke-dashoffset: 0; }
.dipper.drawn line:not(.pointer-line) { animation: draw-line 1s ease forwards; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
.dipper .st { fill: #FBE6B0; }
.dipper .polaris { fill: #FFF8E8; filter: drop-shadow(0 0 6px rgba(251,230,176,.9)); transform-box: fill-box; transform-origin: center; animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.25); } }
.daily h2 { font-size: 2rem; font-weight: 900; margin: 0; letter-spacing: .06em; }
.daily > p { color: var(--mist); margin: .3rem 0 1rem; }
.table { position: relative; height: 330px; max-width: 640px; margin: 0 auto; }
.table .card { position: absolute; left: 50%; top: 30px; margin-left: -77px; cursor: pointer;
  transform: translate(0, 40px) rotate(0); transition: transform .8s var(--ease), opacity .5s; }
.table.fanned .card { transform: translate(var(--x), var(--y)) rotate(var(--r)); }
.table.fanned .card.pick { transform: translate(var(--x), calc(var(--y) - 24px)) rotate(0deg) scale(1.06); z-index: 5; }
.table .card.dim { opacity: .3; }
.table .card:focus-visible { outline: none; }
.table .card:focus-visible .foil { outline: 3px solid var(--gold); outline-offset: 3px; }
@media (hover: hover) { .table.fanned .card:not(.pick):not(.dim):hover { transform: translate(var(--x), calc(var(--y) - 18px)) rotate(var(--r)); } }
.reading { min-height: 7rem; }
.reading p { font-size: 1.15rem; max-width: 26em; margin: 0 auto 1rem; }

/* 桌機但螢幕矮（例如筆電＋瀏覽器放大 125%）：第一屏放得下整個星盤與左欄 */
@media (min-width: 901px) and (max-height: 820px) {
  /* 左邊整塊（含 logo）離左緣遠一點、往下一點；星盤往上一點 */
  .site-header { padding: 1.25rem 3.5rem .2rem; }
  .hero { padding: 0 3.5rem 3rem; gap: 2rem; align-items: stretch; }
  .hero > div:first-child { padding-top: 1.6rem; }
  /* 星盤大小跟著左欄高度：上緣對齊標題，提示字對齊推薦文字那一行（47px＝推薦文字半行＋提示字位置） */
  .dial-col { container-type: size; padding-top: 1.6rem; }
  .dial-wrap { width: min(560px, 100cqw, 100cqh - 47px); }
  .hero h1 { font-size: clamp(1.8rem, 5vh, 2.7rem); margin-bottom: .4rem; }
  .lead { font-size: 1rem; line-height: 1.65; margin-bottom: .9rem; }
  .picked { min-height: 0; gap: 1.2rem; }
  .picked .card { --ch: clamp(160px, 100vh - 383px, 264px); height: var(--ch); width: calc(var(--ch) * .5833); }
  .picked-text h2 { font-size: 1.45rem; }
  .picked-text p { margin-bottom: .7rem; line-height: 1.7; }
  .ask { margin-top: 1rem; }
  .ask h3 { margin-bottom: .3rem; }
  .suggest { margin-top: .4rem; }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 0; padding-top: .5rem; }
  .hero > div:first-child { display: contents; }
  .hero h1 { font-size: 1.75rem; }
  .lead { margin-bottom: 1.5rem; }
  .dial-col { order: 2; }
  .dial-wrap { width: min(440px, 100%); margin-bottom: 3.5rem; }
  .picked { order: 3; min-height: 0; gap: 1.1rem; }
  .picked .card { width: 124px; height: 213px; }
  .picked-text h2 { font-size: 1.4rem; }
  .ask { order: 4; }
  .table { height: 280px; }
  .dipper { left: auto; right: .8rem; top: -5.2rem; width: 84px; height: 146px; opacity: .85; }
  .table .card { width: 124px; height: 213px; margin-left: -62px; }
}
@media (prefers-reduced-motion: reduce) {
  .dipper line { stroke-dashoffset: 0; }
}
