/* night sections (占卜屋), the moon blocks and the tarot table */
.bg-night { background: radial-gradient(ellipse at 50% 0%, #2d3480 0%, var(--night-2) 35%, var(--night) 100%); color: #eef0ff; }
.bg-night.deep { background: radial-gradient(ellipse at 50% 100%, #2a2f73 0%, #10143a 70%); }
.bg-night .sec-head p, .bg-night .feat-text p { color: #c3c8ee; }
.bg-night h2 em { color: var(--gold); background: linear-gradient(transparent 62%, rgba(246, 212, 122, 0.22) 62%); }
.bg-night .feat-text h3 em { color: var(--gold); }
.bg-night .monitor { box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(255, 255, 255, 0.12); }
.bg-night .feat-media .pair .monitor { box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4), 0 0 0 4px rgba(255, 255, 255, 0.12); }
.stars, .bg-night { position: relative; }
.stars::after, .bg-night::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.7;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 27% 64%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 12%, #ffe9a8 50%, transparent 51%), radial-gradient(1px 1px at 58% 40%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 73% 22%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 86% 70%, #cfd6ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 93% 8%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 6% 88%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 36% 90%, #ffe9a8 50%, transparent 51%), radial-gradient(1.5px 1.5px at 66% 82%, #fff 50%, transparent 51%);
  animation: twinkle 4s ease-in-out infinite alternate;
}
.bg-night > .wrap, .stars > .wrap { position: relative; z-index: 1; }
@keyframes twinkle { to { opacity: 0.35; } }

/* ---------------------------------------------------------------- 擲筊 */
.jiao { display: grid; grid-template-columns: 1.55fr 1fr; gap: 24px; align-items: stretch; }
.jiao-stage {
  position: relative; min-height: 440px; border-radius: 22px; overflow: hidden; background: #2b2340;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(255, 255, 255, 0.1);
}
.jiao-canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; image-rendering: pixelated; }
.jiao-stage::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, transparent 45%, rgba(20, 12, 40, 0.55) 100%); }
.jiao-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #c3c8ee; font-weight: 700; }
.jiao-stamp {
  position: absolute; left: 50%; top: 18%; translate: -50% 0; padding: 6px 22px; border-radius: 14px; pointer-events: none;
  font-family: var(--font-display); font-size: clamp(30px, 4vw, 46px); color: #fff; background: rgba(20, 14, 40, 0.55);
  border: 3px solid currentColor; opacity: 0; transform: scale(1.8) rotate(-8deg);
}
.jiao-stamp.show { animation: stamp-in 0.45s var(--spring) both, stamp-out 0.5s 2.6s ease-in forwards; }
.jiao-stamp.sheng { color: #ffd76a; }
.jiao-stamp.xiao { color: #8fe0ff; }
.jiao-stamp.yin { color: #c9a8ff; }
@keyframes stamp-in { to { opacity: 1; transform: scale(1) rotate(-6deg); } }
@keyframes stamp-out { from { opacity: 1; transform: scale(1) rotate(-6deg); } to { opacity: 0; transform: scale(0.9) rotate(-6deg); } }
.jiao-panel {
  display: flex; flex-direction: column; gap: 16px; padding: 22px; border-radius: 22px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.14); backdrop-filter: blur(10px);
}
.field { display: grid; gap: 8px; }
.field > span { font-weight: 700; font-size: 14px; color: #dfe2ff; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.25); color: #fff; outline: none; font-size: 16px;
}
.field input::placeholder { color: #8d93c4; }
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(246, 212, 122, 0.25); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); }
.seg button { padding: 8px 4px; border: 0; border-radius: 9px; background: transparent; color: #c3c8ee; font-weight: 700; font-size: 14px; white-space: nowrap; }
.seg button[aria-checked='true'] { background: var(--gold); color: #3a2a00; }
.seg button:disabled:not([aria-checked='true']) { opacity: 0.45; }
.rule { color: #a9afdc; font-size: 13px; line-height: 1.5; }
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.slot { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.1); animation: pop 0.4s var(--spring); }
.slot svg { width: 64px; height: 24px; }
.slot b { font-family: var(--font-display); font-weight: 400; font-size: 16px; }
.slot.sheng { border-color: rgba(255, 215, 106, 0.6); color: #ffd76a; }
.slot.xiao { color: #8fe0ff; }
.slot.yin { color: #c9a8ff; }
.slot.empty { color: #6f75a8; font-size: 13px; place-items: center; min-height: 62px; animation: none; border-style: dashed; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.verdict { display: grid; gap: 4px; padding: 14px 16px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); min-height: 86px; }
.verdict b { font-family: var(--font-display); font-weight: 400; font-size: 24px; }
.verdict span { color: #c3c8ee; font-size: 14px; }
.verdict.yes { background: linear-gradient(135deg, rgba(255, 215, 106, 0.28), rgba(255, 215, 106, 0.08)); }
.verdict.yes b { color: #ffd76a; }
.verdict.no b { color: #c9a8ff; }
.verdict.unclear b { color: #8fe0ff; }
.verdict.go b { color: #ffd76a; }
.legal { margin: 0; font-size: 12px; color: #8d93c4; }

/* ---------------------------------------------------------------- 每日一牌 */
.tarot { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: stretch; }
.tarot-table {
  position: relative; min-height: 520px; border-radius: 22px; overflow: hidden; perspective: 1200px;
  background: #151a46 url(../tarot/cloth.webp) center / cover; box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(255, 255, 255, 0.1);
  display: grid; place-items: center;
}
.deck { position: relative; width: 150px; aspect-ratio: 7 / 12; padding: 0; border: 0; background: none; transition: transform 0.3s var(--spring), opacity 0.4s; }
.deck i {
  position: absolute; inset: 0; border-radius: 10px; background: #26306e url(../tarot/back.webp) center / cover;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); border: 2px solid rgba(246, 212, 122, 0.5);
  transform: rotate(calc((var(--i) - 3) * 9deg)) translateY(calc(var(--i) * -1px)); transform-origin: 50% 120%;
  transition: transform 0.4s var(--out);
}
.deck i:nth-child(1) { --i: 0; } .deck i:nth-child(2) { --i: 1; } .deck i:nth-child(3) { --i: 2; } .deck i:nth-child(4) { --i: 3; }
.deck i:nth-child(5) { --i: 4; } .deck i:nth-child(6) { --i: 5; } .deck i:nth-child(7) { --i: 6; }
.deck:hover i { transform: rotate(calc((var(--i) - 3) * 13deg)) translateY(-10px); }
.deck span {
  position: absolute; left: 50%; bottom: -54px; translate: -50% 0; padding: 6px 14px; border-radius: 999px; white-space: nowrap;
  font-weight: 700; font-size: 14px; color: #3a2a00; background: var(--gold); box-shadow: 0 4px 0 #b8902f;
  animation: nudge 1.6s ease-in-out infinite;
}
@keyframes nudge { 50% { translate: -50% -4px; } }
.deck.dealt { opacity: 0; pointer-events: none; transform: scale(0.8); }
.tcard { position: absolute; width: min(250px, 56%); aspect-ratio: 7 / 12; perspective: 900px; --rx: 0deg; --ry: 0deg; }
.tcard-in {
  position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.7s var(--out);
  transform: translateY(40px) scale(0.6) rotateY(0deg); opacity: 0;
}
.tcard.out .tcard-in { transform: translateY(0) scale(1) rotateX(var(--rx)) rotateY(var(--ry)); opacity: 1; transition: transform 0.6s var(--spring), opacity 0.3s; }
.tcard.flip .tcard-in { transform: rotateX(var(--rx)) rotateY(calc(180deg + var(--ry))); transition: transform 0.55s var(--out); }
.tcard.flip:hover .tcard-in { transition: transform 0.15s linear; }
.tcard-back, .tcard-face {
  position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55); border: 3px solid rgba(246, 212, 122, 0.7);
}
.tcard-back { background: #26306e center / cover; }
.tcard-face { transform: rotateY(180deg); background: #0f1b3d; }
.tcard.reversed .tcard-face { transform: rotateY(180deg) rotate(180deg); }
.tcard-face img { width: 100%; height: 100%; object-fit: cover; }
.tcard-face b {
  position: absolute; left: 0; right: 0; bottom: 4%; text-align: center; font-family: var(--font-display); font-weight: 400;
  font-size: 20px; color: #fff4d6; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}
.tcard.flip .tcard-face::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.35) 48%, transparent 60%) 120% 0 / 250% 100% no-repeat;
  animation: card-shine 1.2s 0.5s ease-out both;
}
@keyframes card-shine { to { background-position: -60% 0; } }
.tarot-panel {
  display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 26px; border-radius: 22px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.14); backdrop-filter: blur(10px);
}
.tarot-panel.pop { animation: page-in 0.5s var(--out); }
.tarot-panel h3 { font-size: 28px; color: #fff4d6; }
.tarot-panel p { margin: 0; color: #c3c8ee; }
.tarot-panel .work { padding: 12px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); }
.tarot-panel .work b { color: var(--gold); }
.tarot-panel .note { font-size: 13px; color: #8d93c4; }
.tarot-panel .btn { align-self: flex-start; margin-top: 6px; }
.tarot-panel small { color: #8d93c4; font-family: var(--font-num); letter-spacing: 0.04em; }
.tarot-panel .chips { margin: 4px 0; }
.tarot-panel .chip { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.18); color: #eef0ff; }
.pos { align-self: flex-start; padding: 2px 10px; border-radius: 999px; font-weight: 700; font-size: 13px; background: var(--gold); color: #3a2a00; }
.pos.rev { background: #c9a8ff; color: #241544; }
.tarot-empty, .tarot-read { display: flex; flex-direction: column; gap: 10px; }
.tarot-empty[hidden], .tarot-read[hidden] { display: none; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: #dfe2ff; margin-top: 6px; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }

/* secretary portrait on 秘書與協作 */
.sec-portrait { position: relative; justify-self: center; width: min(330px, 80%); }
.sec-portrait img { width: 100%; height: auto; filter: drop-shadow(0 20px 30px rgba(10, 50, 80, 0.25)); }
.sec-portrait .bubble {
  position: absolute; left: -6%; bottom: 14%; max-width: 70%; padding: 12px 16px; border-radius: 16px 16px 16px 4px;
  font-weight: 700; background: #fff; box-shadow: var(--shadow-float); animation: bob 3s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-6px); } }

/* download cards */
.dl-cards { display: grid; gap: 14px; }
.dl { padding: 20px 22px; border-radius: 20px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-float); }
.dl .os { font-family: var(--font-pixel); font-size: 11px; letter-spacing: 0.1em; color: #fff; background: var(--ink); padding: 2px 8px; border-radius: 5px; }
.dl b { display: block; margin: 8px 0 4px; font-family: var(--font-display); font-weight: 400; font-size: 22px; }
.dl p { margin: 0; color: var(--muted); font-size: 15px; }
.dl code { font-family: var(--font-num); font-weight: 700; color: var(--lagoon); background: var(--shallow); padding: 1px 6px; border-radius: 5px; }

@media (max-width: 960px) {
  .jiao, .tarot { grid-template-columns: 1fr; }
  .jiao-stage { min-height: 340px; }
  .tarot-table { min-height: 460px; }
}
@media (max-width: 600px) {
  .jiao-stage { min-height: 280px; }
  .seg button { font-size: 13px; }
  .sec-portrait .bubble { left: 0; }
}
