/* 塔羅抽牌頁（/tarot/）：星環選牌、牌陣、翻牌、結果、說明；頁首頁尾與按鈕在 site.css，卡面在 foil-card.css */
.tool { max-width: 1100px; margin: 0 auto; padding: .5rem 1.5rem 2rem; text-align: center; position: relative; }
.tool .crumbs { text-align: left; }
.tool h1 { font-size: 2.3rem; font-weight: 900; margin: .3rem 0 0; letter-spacing: .05em; line-height: 1.4; }
.tool .lead { color: var(--mist); margin: .3rem auto 1.2rem; max-width: 34em; }
.phrases span { display: inline-block; }

/* 三段流程：每段一個標題（「1. 要做的事」）；data-step 決定哪些段落顯示 */
/* 三步的標題同一個樣式：一行「1. 想一個問題」，數字金色（使用者 12-06 要求，比上下兩行省版面）；(i) 掛在標題右邊、不參與置中，標題文字才會正好在中線上 */
.sec-title { margin: 0; font-size: var(--t, 1.35rem); line-height: 1.5; }
.sec-title span { color: var(--gold); font-weight: 900; margin-right: .35em; }
.sec-title b { color: var(--star); font-weight: 900; letter-spacing: .06em; }
.sec-ask { padding-bottom: 1.6rem; }
.btn-go { font-size: 1.15rem; padding: .75rem 2.6rem; margin-top: .3rem; }
.sec-pick { min-height: calc(100svh - 1rem); padding-top: 1.2rem; display: flex; flex-direction: column; justify-content: center;
  border-top: 1px solid rgba(239,197,111,.18); }
.sec-pick .orbit { height: clamp(280px, calc(100svh - 230px), 520px); width: 100%; }
/* 還沒洗牌：第 2 步只留一行提示，星環先不出現 */
.next-hint { display: none; margin: 0; color: var(--mist); font-size: .95rem; letter-spacing: .1em; }
.next-hint::before { content: ""; display: block; width: 9px; height: 9px; margin: 0 auto .5rem; border-right: 1px solid var(--gold); border-bottom: 1px solid var(--gold); transform: rotate(45deg); }
.tool[data-step="1"] .sec-pick { min-height: 0; padding: 1.4rem 0 .6rem; }
.tool[data-step="1"] .sec-pick > :not(.next-hint) { display: none; }
.tool[data-step="1"] .next-hint { display: block; }
.sec-read { display: none; min-height: 100svh; padding-top: 1.4rem; border-top: 1px solid rgba(239,197,111,.18); }   /* 至少一屏高：頁面夠長，選完才捲得到第 3 步頂端 */
.tool[data-step="3"] .sec-read { display: block; }
/* 選牌進度：每選一張，對應的位置變金色打勾 */
.chips { list-style: none; display: flex; justify-content: center; gap: .6rem; padding: 0; margin: .2rem 0 .3rem; }
.chips li { font-size: .9rem; color: var(--mist); border: 1px dashed rgba(239,197,111,.5); border-radius: 999px; padding: .1rem .9rem; letter-spacing: .1em; }
.chips li.done { background: var(--gold); color: var(--night); border-style: solid; font-weight: 700; }
.chips li.done::before { content: ""; display: inline-block; width: .32em; height: .62em; margin: 0 .55em 0 .1em; border: solid currentColor;
  border-width: 0 2px 2px 0; transform: translateY(-.12em) rotate(45deg); }   /* 用線條畫勾：字型會把 ✓ 畫成根號 */

/* 工具列：牌陣切換＋問題（兩者同高） */
.controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .8rem 1.2rem; margin-bottom: 1rem; }
.seg, .q { box-sizing: border-box; height: 2.6rem; }
.seg { display: inline-flex; border: 1px solid rgba(239,197,111,.55); border-radius: 999px; padding: 3px; background: rgba(29,21,69,.55); }
.seg button { font: inherit; font-size: .95rem; color: var(--mist); background: none; border: 0; border-radius: 999px; padding: 0 1.1rem; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--gold); color: var(--night); font-weight: 700; }
.q { font: inherit; font-size: .95rem; color: var(--star); background: rgba(29,21,69,.55); border: 1px solid rgba(185,174,221,.4);
  border-radius: 999px; padding: 0 1.1rem; width: min(22rem, 100%); }
.q::placeholder { color: rgba(185,174,221,.75); }
.step { min-height: 1.6em; color: var(--mist); margin: 0; font-size: .95rem; }

/* 星環 */
.orbit { position: relative; height: 420px; margin: 0 auto .5rem; max-width: 980px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.orbit.idle { cursor: grab; }
.orbit.dragging { cursor: grabbing; }
.orbit .track { position: absolute; left: 50%; top: 50%; width: var(--rx2); height: var(--ry2); transform: translate(-50%, -50%);
  border: 1px solid rgba(239,197,111,.28); border-radius: 50%; pointer-events: none; }
.orbit .hub { --ink: url(#fc-line); --hole: #2C2268; position: absolute; left: 50%; top: 50%; width: 132px; height: 132px; 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 50px rgba(139,58,142,.9); }
.orbit .hub svg { width: 64%; }
.orbit.spinning .hub::after { content: ""; position: absolute; inset: -30px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(239,197,111,.55), transparent 70%); opacity: 0; animation: pulse 1.8s ease-in-out; }
@keyframes pulse { 50% { opacity: 1; } }
.mini { width: 72px; height: 123px; position: relative; flex: none; }
.mini .foil { border-radius: 6px; backface-visibility: visible; box-shadow: 0 1px 0 #C9A04A, 0 2px 0 #4A2F7E, 0 10px 18px -6px rgba(8,3,24,.7); }
.orbit .ring { position: absolute; left: 50%; top: 50%; margin: -62px 0 0 -36px; will-change: transform; }
.orbit.idle .ring:not(.back-row) { cursor: pointer; }
.orbit .ring.back-row, .orbit:not(.idle) .ring, .orbit.full .ring { pointer-events: none; }
.orbit .ring .foil::after { content: ""; position: absolute; inset: 0; border-radius: 6px; pointer-events: none; opacity: 0; transition: opacity .25s;
  box-shadow: inset 0 0 0 2px var(--gold), 0 0 26px rgba(239,197,111,.75); }
.orbit .ring.lift .foil::after { opacity: 1; }
.orbit .ring:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.orbit .ring.gone { opacity: 0 !important; pointer-events: none; transition: opacity .4s; }
.hint { color: var(--mist); font-size: .9rem; margin: 0; min-height: 1.6em; }

/* 大牌：翻面 */
.card { width: 132px; height: 226px; perspective: 1200px; flex: none; }
.tilt { display: block; 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 .9s var(--ease); }
.card.down .card-in { transform: rotateY(180deg); }
.card.rev .front-face svg { transform: rotate(180deg); }
.card.deal .tilt { animation: deal .6s var(--ease) both; }
@keyframes deal { from { transform: translateY(-70px) scale(.6); opacity: 0; } }

/* 牌陣位置 */
.slots { display: flex; justify-content: center; gap: 1.6rem; margin: 1.2rem 0 .4rem; }
.slot { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.slot .place { width: 132px; height: 226px; border: 1px dashed rgba(239,197,111,.45); border-radius: 9px; display: grid; place-items: center;
  color: rgba(239,197,111,.6); font-size: 1.6rem; }
/* 翻牌後：位置一行、牌名一行，牌名不折斷（LOOP.md §2） */
.slot .label { color: var(--mist); font-size: .95rem; letter-spacing: .1em; display: flex; flex-direction: column; align-items: center; line-height: 1.55; }
.slot .label > * { white-space: nowrap; }
.slot .label b { color: var(--gold-pale); font-weight: 700; }

/* 結果 */
.reading { max-width: 43rem; margin: 1rem auto 0; text-align: left; }
.reading .asked { color: var(--mist); margin: 0 0 1rem; overflow-wrap: anywhere; }
.reading .asked span { color: var(--star); }
.reading article { border-left: 2px solid var(--gold); padding: .1rem 0 .1rem 1.1rem; margin: 0 0 1.1rem; animation: rise .6s ease both; }
.reading article:has(.thumb) { display: flex; gap: 1rem; align-items: flex-start; }
.reading .thumb { flex: none; width: 3.6rem; aspect-ratio: 140 / 240; border-radius: 5px; overflow: hidden; box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
.reading .thumb.rev { transform: rotate(180deg); }   /* 逆位：小牌倒過來 */
.reading h2 { margin: 0; font-size: 1.15rem; color: var(--gold-pale); }
.reading p { margin: .2rem 0 0; }
.reading .more a { color: var(--gold-pale); font-size: .95rem; text-underline-offset: 4px; }
.reading .disclaim { color: var(--mist); font-size: .85rem; }
.reading .again { text-align: center; margin-top: 1rem; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* 工具下方的說明文 */
.tarot-guide { padding-top: 0; }
.tarot-guide h2:first-child { margin-top: 1rem; }

/* (i) 說明：標題旁的小按鈕，點了在標題下方浮出說明卡（蓋在內容上、不推動版面，星環不會被擠出畫面） */
.sec-head { --t: 1.35rem; position: relative; width: fit-content; margin: 0 auto .5rem; }
.info summary { list-style: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--gold); cursor: pointer;
  position: absolute; left: calc(100% + .35rem); bottom: calc(var(--t) * 1.5 / 2 - 14px); }   /* 對齊標題那一行的垂直中線 */
.info summary::-webkit-details-marker { display: none; }
.info summary:hover, .info[open] summary { color: var(--star); background: rgba(239,197,111,.14); }
.info summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.info-body { position: absolute; top: calc(100% + .5rem); left: 50%; transform: translateX(-50%); z-index: 300; width: min(34rem, calc(100vw - 2rem));
  text-align: left; background: #1D1545; border: 1px solid rgba(239,197,111,.5); border-radius: 12px; padding: .9rem 1.2rem .7rem;
  box-shadow: 0 18px 40px -10px rgba(6,2,20,.85); font-size: .95rem; line-height: 1.75; }
.info-body h3 { margin: .4rem 0 .1rem; font-size: 1rem; color: var(--gold-pale); }
.info-body h3:first-child { margin-top: 0; }
.info-body p, .info-body ul { margin: 0 0 .5rem; }
.info-body ul { padding-left: 1.2rem; }
.info-body a { color: var(--gold-pale); }
.info-actions { text-align: right; margin: .2rem 0 0 !important; }
.info-close { font: inherit; font-size: .9rem; color: var(--gold-pale); background: none; border: 1px solid rgba(239,197,111,.6); border-radius: 999px; padding: .1rem .9rem; cursor: pointer; }

/* 矮螢幕（例如 1920 螢幕開 125% 縮放＝約 1227×548）：第 2 步的星環照螢幕高度縮小，整段放得進一屏 */
@media (min-width: 701px) and (max-height: 820px) {
  .sec-pick .orbit { height: clamp(260px, calc(100svh - 205px), 520px); }
  .sec-head { --t: 1.2rem; }
  .orbit .hub { width: 104px; height: 104px; }
  .mini { width: 58px; height: 99px; }
  .orbit .ring { margin: -50px 0 0 -29px; }
}
@media (max-width: 700px) {
  .tool h1 { font-size: 1.6rem; }
  .sec-pick .orbit { height: 330px; }
  .sec-pick { min-height: 0; justify-content: flex-start; padding: 1.6rem 0 1rem; }
  .controls { flex-direction: column; }
  .orbit .hub { width: 92px; height: 92px; }
  .mini { width: 52px; height: 89px; }
  .orbit .ring { margin: -45px 0 0 -26px; }
  .card, .slot .place { width: 96px; height: 164px; }
  .slots { gap: .7rem; }
  .slot .label { font-size: .85rem; letter-spacing: .04em; }
}
@media (prefers-reduced-motion: reduce) {
  .card-in, .tilt, .orbit .ring.gone { transition: none; }
  .card.deal .tilt, .reading article, .orbit.spinning .hub::after { animation: none; }
}
