/* ============================================================
   萬神錄 · 觀音一百籤
   ------------------------------------------------------------
   這一頁的節奏刻意慢：先寫心念 → 抽籤 → 擲筊 → 才給籤。
   因此每一步只放一個主要動作，其餘留白；不用進度條催人，
   也不把「再抽一支」放在最顯眼的位置 —— 求籤的規矩是問一次。

   視覺沿用古籍頁：金線收尾、深底、宋體籤詩；
   擲筊的兩片木筊用 CSS 3D 翻轉，不載圖片，避免多一個請求。
   ============================================================ */

.qn-wrap {
  max-width: 820px;
  padding-top: 26px;
  padding-bottom: 60px;
}

/* ── 麵包屑 ── */
.qn-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 16px;
  font-size: 12.5px;
  color: #778089;
}
.qn-crumb a { color: #9a6206; text-decoration: none; }
.qn-crumb a:hover { color: #b3401e; }
.qn-crumb span[aria-hidden] { color: #778089; }

/* ── 頁首 ── */
.qn-head { margin-bottom: 22px; }
.qn-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: .34em;
  color: #778089;
}
.qn-head h1 {
  position: relative;
  margin: 0 0 16px;
  padding-bottom: 14px;
  font-size: 27px;
  font-weight: 500;
  letter-spacing: .14em;
  color: #3f4750;
}
.qn-head h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, rgba(179,64,30,.45), rgba(20,24,29,0.05));
}
.qn-sub {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.95;
  color: #778089;
  max-width: 40em;
}

/* ── 步驟 ── */
.qn-step {
  position: relative;
  margin: 0 0 16px;
  padding: 20px 20px 22px;
  border: 1px solid rgba(20,24,29,.14);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(20,24,29,.05), rgba(20,24,29,.04));
}
.qn-step[hidden] { display: none; }

.qn-step-no {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 11.5px;
  letter-spacing: .24em;
  color: #778089;
}
.qn-step-no::before {
  content: "";
  width: 14px;
  height: 1px;
  background: rgba(179,64,30,.45);
}

.qn-label {
  display: block;
  margin: 0 0 8px;
  font-size: 12.5px;
  letter-spacing: .1em;
  color: #778089;
}

.qn-hint {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.85;
  color: #778089;
}

/* ── 心念輸入 ── */
#ask {
  width: 100%;
  min-height: 96px;
  padding: 13px 14px;
  border: 1px solid rgba(20,24,29,.2);
  border-radius: 12px;
  background: rgba(20,24,29,.04);
  color: #14181d;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.8;
  resize: vertical;
}
#ask:focus {
  outline: none;
  border-color: rgba(179,64,30,.45);
  box-shadow: 0 0 0 3px rgba(20,24,29,0.1);
}

/* 問事類別：可選，不強迫 */
.qn-topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.qn-topics button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(20,24,29,.2);
  border-radius: 999px;
  background: transparent;
  color: #9a6206;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .18s, background .18s, color .18s;
}
.qn-topics button:hover { border-color: rgba(179,64,30,.45); }
.qn-topics button[aria-pressed="true"] {
  border-color: rgba(179,64,30,.45);
  background: rgba(20,24,29,.14);
  color: #8f3211;
}

/* ── 主要按鈕 ── */
.qn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  margin-top: 18px;
  padding: 0 30px;
  border: 1px solid rgba(179,64,30,.45);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(20,24,29,.2), rgba(20,24,29,0.07));
  color: #8f3211;
  font-size: 15px;
  font-family: var(--serif);
  letter-spacing: .28em;
  cursor: pointer;
  transition: background .2s, box-shadow .2s, transform .15s;
}
.qn-btn:hover { background: linear-gradient(180deg, rgba(179,64,30,.45), rgba(20,24,29,.14)); box-shadow: 0 6px 22px rgba(20,24,29,.14); }
.qn-btn:active { transform: translateY(1px); }
.qn-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.qn-btn--wide { display: flex; width: 100%; }

.qn-btn--ghost {
  border-color: rgba(20,24,29,.2);
  background: transparent;
  color: #778089;
  letter-spacing: .18em;
  font-size: 13.5px;
  min-height: 40px;
  padding: 0 20px;
}
.qn-btn--ghost:hover { background: rgba(20,24,29,0.06); border-color: rgba(179,64,30,.45); }

.qn-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* ── 籤筒 ── */
.qn-tube {
  position: relative;
  width: 108px;
  height: 132px;
  margin: 22px auto 8px;
  border: 1px solid rgba(179,64,30,.45);
  border-radius: 10px 10px 16px 16px;
  background: linear-gradient(180deg, rgba(154,98,6,.12), rgba(154,98,6,.14));
  box-shadow: inset 0 0 22px rgba(16,24,40,.08), 0 12px 30px rgba(16,24,40,.12);
}
.qn-tube::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 14px;
  height: 1px;
  background: rgba(179,64,30,.45);
}
.qn-stick {
  position: absolute;
  bottom: 26px;
  width: 9px;
  height: 96px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #9a6206, #9a6206);
  box-shadow: 0 0 0 1px #ffffff;
  transform-origin: 50% 100%;
}
.qn-stick:nth-child(1) { left: 22px; height: 88px; transform: rotate(-7deg); }
.qn-stick:nth-child(2) { left: 40px; height: 98px; transform: rotate(2deg); }
.qn-stick:nth-child(3) { left: 58px; height: 92px; transform: rotate(-2deg); }
.qn-stick:nth-child(4) { left: 74px; height: 84px; transform: rotate(6deg); }
.qn-stick--rise { left: 46px !important; height: 108px !important; transform: translateY(-26px) rotate(-1deg) !important; }

.qn-tube.is-shaking { animation: qn-shake .5s ease-in-out 2; }
@keyframes qn-shake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(-2px, 0) rotate(-1.2deg); }
  50% { transform: translate(2px, 0) rotate(1.2deg); }
  75% { transform: translate(-1px, 0) rotate(-.6deg); }
}
@media (prefers-reduced-motion: reduce) {
  .qn-tube.is-shaking { animation: none; }
  .qn-stick--rise { transition: none !important; }
}

.qn-status {
  margin: 6px 0 0;
  text-align: center;
  font-size: 13.5px;
  color: #778089;
  line-height: 1.9;
}
.qn-status b { color: #b3401e; font-weight: 500; }

/* ── 擲筊 ── */
.qn-jb-stage {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 16px 0 6px;
  min-height: 74px;
}
.qn-jb {
  width: 58px;
  height: 42px;
  border-radius: 50% / 46%;
  background: linear-gradient(180deg, #b3401e, #9a6206);
  box-shadow: inset 0 -4px 8px rgba(16,24,40,.12), 0 6px 14px rgba(16,24,40,.10);
  transition: transform .45s cubic-bezier(.2, .7, .3, 1.2);
  transform-style: preserve-3d;
}
/* 平面朝上＝平；凸面朝上＝凸 */
.qn-jb.is-flat { background: linear-gradient(180deg, #b3401e, #9a6206); }
.qn-jb.is-round {
  background: radial-gradient(circle at 50% 34%, #c9583a, #9a6206 70%);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.7), 0 6px 14px rgba(16,24,40,.10);
}
.qn-jb.is-tossing { animation: qn-toss .5s ease-out; }
@keyframes qn-toss {
  0% { transform: translateY(0) rotateY(0); }
  45% { transform: translateY(-34px) rotateY(200deg); }
  100% { transform: translateY(0) rotateY(360deg); }
}

.qn-jb-count {
  text-align: center;
  font-size: 13px;
  letter-spacing: .12em;
  color: #778089;
}
.qn-jb-count b { color: #9a6206; font-variant-numeric: tabular-nums; }
.qn-jb-say {
  margin: 8px 0 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.9;
  color: #778089;
}
.qn-jb-say .good { color: #1a7f4b; }
.qn-jb-say .bad { color: #b3261e; }
.qn-jb-say .even { color: #778089; }

/* ── 結果 ── */
.qn-result[hidden] { display: none; }

.qn-slip {
  position: relative;
  margin: 0 0 18px;
  padding: 24px 22px 26px;
  border: 1px solid rgba(179,64,30,.45);
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(20,24,29,0.1), transparent 60%),
    linear-gradient(180deg, rgba(20,24,29,.05), rgba(20,24,29,.05));
  box-shadow: 0 18px 46px rgba(16,24,40,.10);
}
/* 籤紙邊緣的細框，像裱在紙上 */
.qn-slip::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(20,24,29,.14);
  border-radius: 12px;
  pointer-events: none;
}

.qn-slip-no {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 4px;
  font-size: 12.5px;
  letter-spacing: .22em;
  color: #778089;
}
.qn-grade {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: .14em;
}
.qn-grade.good { color: #1a7f4b; }
.qn-grade.even { color: #778089; }
.qn-grade.bad  { color: #b3261e; }

.qn-slip-title {
  margin: 0 0 18px;
  text-align: center;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: .12em;
  color: #3f4750;
}

.qn-poem {
  margin: 0;
  padding: 4px 0 2px;
  list-style: none;
  text-align: center;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 2.15;
  letter-spacing: .16em;
  color: #3f4750;
}
.qn-poem li { margin: 0; }

.qn-slip-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.qn-slip-tags li {
  padding: 3px 11px;
  border: 1px solid rgba(20,24,29,.2);
  border-radius: 999px;
  font-size: 12px;
  color: #778089;
}

/* ── 解說區 ── */
.qn-read { margin: 22px 0 0; }
.qn-read h2 {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .2em;
  color: #9a6206;
}
.qn-read h2::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 1px;
  margin-right: 8px;
  vertical-align: 3px;
  background: rgba(179,64,30,.45);
}
.qn-prose {
  margin: 0;
  font-size: 15.5px;
  line-height: 2;
  color: #778089;
}
.qn-note {
  margin: 26px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(20,24,29,.14);
  font-size: 12.5px;
  line-height: 1.9;
  color: #778089;
}

/* ── 問事分項 ── */
.qn-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.qn-tabs button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(20,24,29,.2);
  border-radius: 999px;
  background: transparent;
  color: #778089;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.qn-tabs button[aria-selected="true"] {
  border-color: rgba(179,64,30,.45);
  background: rgba(20,24,29,.14);
  color: #8f3211;
}
.qn-panel {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid rgba(20,24,29,.14);
  border-radius: 12px;
  background: rgba(20,24,29,.04);
  font-size: 15px;
  line-height: 1.95;
  color: #778089;
  min-height: 3.2em;
}

/* ── 結果頁尾動作 ── */
.qn-foot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 0;
}
.qn-link-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(20,24,29,.2);
  border-radius: 999px;
  background: transparent;
  color: #778089;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.qn-link-btn:hover { border-color: rgba(179,64,30,.45); color: #b3401e; }

.qn-toast {
  margin: 10px 0 0;
  font-size: 13px;
  color: #1a7f4b;
  min-height: 1.4em;
}

/* ── 錯誤／冷卻 ── */
.qn-err { margin: 10px 0 0; font-size: 13.5px; color: #b3261e; line-height: 1.9; }
.qn-cool { margin: 10px 0 0; font-size: 13.5px; color: #9a6206; line-height: 1.9; }

/* ── 手機 ── */
@media (max-width: 768px) {
  .qn-wrap { padding-top: 20px; padding-bottom: 46px; }
  .qn-head h1 { font-size: 23px; letter-spacing: .1em; }
  .qn-sub { font-size: 14px; }
  .qn-step { padding: 17px 16px 19px; border-radius: 16px; }
  .qn-btn { width: 100%; }
  .qn-actions .qn-btn { width: 100%; }
  .qn-poem { font-size: 17.5px; line-height: 2.2; letter-spacing: .1em; }
  .qn-slip { padding: 20px 16px 22px; }
  .qn-slip-title { font-size: 20px; }
  .qn-prose { font-size: 15px; line-height: 1.95; }
  .qn-tabs button { min-height: 38px; }
  .qn-jb { width: 52px; height: 38px; }
}
