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

   視覺沿用古籍頁：金線收尾、深底、宋體籤詩；
   擲筊的兩片木筊用 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: #8f8677;
}
.qn-crumb a { color: #b9a276; text-decoration: none; }
.qn-crumb a:hover { color: #e0c482; }
.qn-crumb span[aria-hidden] { color: #5f5648; }

/* ── 頁首 ── */
.qn-head { margin-bottom: 22px; }
.qn-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: .34em;
  color: #a8946a;
}
.qn-head h1 {
  position: relative;
  margin: 0 0 16px;
  padding-bottom: 14px;
  font-size: 27px;
  font-weight: 500;
  letter-spacing: .14em;
  color: #efe2c4;
}
.qn-head h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, rgba(224, 196, 130, .9), rgba(224, 196, 130, .05));
}
.qn-sub {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.95;
  color: #a99c86;
  max-width: 40em;
}

/* ── 步驟 ── */
.qn-step {
  position: relative;
  margin: 0 0 16px;
  padding: 20px 20px 22px;
  border: 1px solid rgba(224, 196, 130, .16);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(32, 23, 45, .6), rgba(19, 13, 27, .5));
}
.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: #a8946a;
}
.qn-step-no::before {
  content: "";
  width: 14px;
  height: 1px;
  background: rgba(224, 196, 130, .6);
}

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

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

/* ── 心念輸入 ── */
#ask {
  width: 100%;
  min-height: 96px;
  padding: 13px 14px;
  border: 1px solid rgba(224, 196, 130, .22);
  border-radius: 12px;
  background: rgba(10, 8, 14, .68);
  color: #efe6d5;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.8;
  resize: vertical;
}
#ask:focus {
  outline: none;
  border-color: rgba(224, 196, 130, .6);
  box-shadow: 0 0 0 3px rgba(224, 196, 130, .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(224, 196, 130, .22);
  border-radius: 999px;
  background: transparent;
  color: #c8b07c;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .18s, background .18s, color .18s;
}
.qn-topics button:hover { border-color: rgba(224, 196, 130, .5); }
.qn-topics button[aria-pressed="true"] {
  border-color: rgba(224, 196, 130, .62);
  background: rgba(224, 196, 130, .12);
  color: #f4dfa4;
}

/* ── 主要按鈕 ── */
.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(224, 196, 130, .55);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(224, 196, 130, .2), rgba(224, 196, 130, .07));
  color: #f4dfa4;
  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(224, 196, 130, .3), rgba(224, 196, 130, .12)); box-shadow: 0 6px 22px rgba(224, 196, 130, .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(224, 196, 130, .2);
  background: transparent;
  color: #a99c86;
  letter-spacing: .18em;
  font-size: 13.5px;
  min-height: 40px;
  padding: 0 20px;
}
.qn-btn--ghost:hover { background: rgba(224, 196, 130, .06); border-color: rgba(224, 196, 130, .38); }

.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(224, 196, 130, .38);
  border-radius: 10px 10px 16px 16px;
  background: linear-gradient(180deg, rgba(90, 60, 32, .55), rgba(48, 30, 16, .75));
  box-shadow: inset 0 0 22px rgba(0, 0, 0, .5), 0 12px 30px rgba(0, 0, 0, .35);
}
.qn-tube::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 14px;
  height: 1px;
  background: rgba(224, 196, 130, .28);
}
.qn-stick {
  position: absolute;
  bottom: 26px;
  width: 9px;
  height: 96px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #d9bd86, #8a6534);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
  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: #a99c86;
  line-height: 1.9;
}
.qn-status b { color: #e0c482; 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, #c9a063, #7c5127);
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, .35), 0 6px 14px rgba(0, 0, 0, .3);
  transition: transform .45s cubic-bezier(.2, .7, .3, 1.2);
  transform-style: preserve-3d;
}
/* 平面朝上＝平；凸面朝上＝凸 */
.qn-jb.is-flat { background: linear-gradient(180deg, #d8b578, #94662f); }
.qn-jb.is-round {
  background: radial-gradient(circle at 50% 34%, #e2c089, #8a5c2a 70%);
  box-shadow: inset 0 0 0 2px rgba(255, 236, 200, .22), 0 6px 14px rgba(0, 0, 0, .3);
}
.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: #a99c86;
}
.qn-jb-count b { color: #f0d9a6; font-variant-numeric: tabular-nums; }
.qn-jb-say {
  margin: 8px 0 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.9;
  color: #d8c8a6;
}
.qn-jb-say .good { color: #8fd9ac; }
.qn-jb-say .bad { color: #e8a0a0; }
.qn-jb-say .even { color: #c9b184; }

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

.qn-slip {
  position: relative;
  margin: 0 0 18px;
  padding: 24px 22px 26px;
  border: 1px solid rgba(224, 196, 130, .34);
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(224, 196, 130, .1), transparent 60%),
    linear-gradient(180deg, rgba(38, 27, 50, .82), rgba(17, 12, 24, .78));
  box-shadow: 0 18px 46px rgba(0, 0, 0, .3);
}
/* 籤紙邊緣的細框，像裱在紙上 */
.qn-slip::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(224, 196, 130, .12);
  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: #a8946a;
}
.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: #8fd9ac; }
.qn-grade.even { color: #c9b184; }
.qn-grade.bad  { color: #e8a0a0; }

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

.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: #eadfc7;
}
.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(224, 196, 130, .2);
  border-radius: 999px;
  font-size: 12px;
  color: #b9ac93;
}

/* ── 解說區 ── */
.qn-read { margin: 22px 0 0; }
.qn-read h2 {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .2em;
  color: #c9a05e;
}
.qn-read h2::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 1px;
  margin-right: 8px;
  vertical-align: 3px;
  background: rgba(224, 196, 130, .7);
}
.qn-prose {
  margin: 0;
  font-size: 15.5px;
  line-height: 2;
  color: #ded2ba;
}
.qn-note {
  margin: 26px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(224, 196, 130, .12);
  font-size: 12.5px;
  line-height: 1.9;
  color: #8f8677;
}

/* ── 問事分項 ── */
.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(224, 196, 130, .2);
  border-radius: 999px;
  background: transparent;
  color: #b9ac93;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.qn-tabs button[aria-selected="true"] {
  border-color: rgba(224, 196, 130, .6);
  background: rgba(224, 196, 130, .12);
  color: #f4dfa4;
}
.qn-panel {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid rgba(224, 196, 130, .14);
  border-radius: 12px;
  background: rgba(12, 9, 18, .5);
  font-size: 15px;
  line-height: 1.95;
  color: #ded2ba;
  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(224, 196, 130, .22);
  border-radius: 999px;
  background: transparent;
  color: #b9ac93;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.qn-link-btn:hover { border-color: rgba(224, 196, 130, .45); color: #e0c482; }

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

/* ── 錯誤／冷卻 ── */
.qn-err { margin: 10px 0 0; font-size: 13.5px; color: #ffb0b0; line-height: 1.9; }
.qn-cool { margin: 10px 0 0; font-size: 13.5px; color: #ffc98a; 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; }
}
