:root {
  color-scheme: dark;
  font-family: "PingFang TC", "Noto Sans TC", sans-serif;
  color: #f6efff;
  background: #151027;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(ellipse at 50% 0%, #36244d, transparent 70%), #151027;
}
main { width: min(100% - 32px, 700px); margin: auto; padding: 34px 0; }
header { text-align: center; margin-bottom: 22px; }
.credit { color: #eac78e; font-size: .875rem; letter-spacing: .2em; margin: 0 0 10px; }
h1 { font-family: "Songti TC", "Noto Serif TC", serif; font-size: clamp(2rem, 7vw, 3.35rem); margin: 0; letter-spacing: .08em; }
.card { overflow: hidden; border: 1px solid #755988; border-radius: 24px; background: #211832; box-shadow: 0 24px 70px #09061488; }
.scene {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  aspect-ratio: 1.65;
  overflow: clip;
  background: repeating-linear-gradient(90deg, #130d231f 0 1px, transparent 1px 12%), radial-gradient(ellipse at 50% 54%, #654370, #2b1e43 69%, #1c162f);
}
.window { position: absolute; top: 8%; left: 10%; width: 21%; height: 52%; border: .9cqw solid #89657e; border-radius: 50% 50% 8% 8% / 38% 38% 8% 8%; background: linear-gradient(#191e43, #423164); color: #eec9ff; text-align: right; padding: 5% 2%; font-size: 2.6cqw; box-shadow: 0 0 0 .7cqw #241731; }
.window i { position: absolute; top: 23%; left: 24%; width: 34%; aspect-ratio: 1; border-radius: 50%; box-shadow: -.8cqw .7cqw #ffe0a4; }
.sky-stars { position: absolute; top: 15%; left: 37%; width: 31%; display: flex; justify-content: space-between; color: #e5b6e8; font-size: 3cqw; }
.sky-stars span { margin-top: -3%; }
.shelf { position: absolute; top: 35%; right: 7%; width: 24%; height: 4%; border-radius: 12px; background: #856175; box-shadow: 0 .7cqw #29192f; }
.shelf i { display: block; position: absolute; bottom: 100%; left: 11%; width: 13%; height: 430%; background: #9d5b87; border-radius: 3px 3px 0 0; border-bottom: .6cqw solid #e6af90; }
.shelf i:nth-child(2) { left: 26%; height: 540%; background: #596393; }
.shelf i:nth-child(3) { left: 42%; height: 380%; background: #9e735b; transform: rotate(-8deg); }
.shelf b { position: absolute; bottom: 100%; right: 9%; width: 24%; aspect-ratio: .85; border-radius: 40% 40% 30% 30%; background: #567d85; border-top: .8cqw solid #d0a779; }
.table { position: absolute; inset: 74% -8% -22%; border-radius: 50% 50% 0 0 / 24% 24% 0 0; background: repeating-linear-gradient(0deg, transparent 0 1.8cqw, #45263b42 1.8cqw 2cqw), radial-gradient(ellipse at 50% 10%, #9c587c, #542d49 65%); border-top: .7cqw solid #b47792; }
.candle { position: absolute; bottom: 17%; left: 17%; width: 4%; height: 12%; border-radius: 10% 10% 20% 20%; background: linear-gradient(90deg,#ac617f,#ffe0b4 60%,#bd7287); box-shadow: 0 .7cqw 0 .55cqw #a76c74; }
.candle i { position: absolute; left: 25%; bottom: 110%; width: 50%; height: 70%; border-radius: 70% 40% 55% 55%; background: #ffe2a0; box-shadow: 0 0 2.5cqw 1.3cqw #ffb36a6b; animation: flicker 1.7s infinite alternate; }
.cat { position: absolute; left: 32%; top: 19%; width: 36%; height: 58%; }
.body,.head,.tail,.ear,.paw { position: absolute; background: #1a1529; }
.body { bottom: 0; left: 16%; width: 70%; height: 51%; border-radius: 50% 50% 27% 25%; }
.tail { width: 44%; height: 15%; bottom: 3%; right: -14%; border-radius: 0 75% 80% 0; transform: rotate(-24deg); transform-origin: left; box-shadow: inset 0 -.5cqw #3a2d4e; }
.ear { top: 1%; width: 35%; height: 43%; border-radius: 21% 90% 20% 25%; }
.ear::after { content: ""; position: absolute; inset: 23% 22% 17% 24%; background: #9c607f; border-radius: inherit; }
.ear.left { left: 8%; transform: rotate(-17deg); }
.ear.right { right: 8%; transform: scaleX(-1) rotate(-17deg); }
.head { top: 20%; left: 4%; width: 92%; height: 58%; border-radius: 45% 45% 46% 46%; background: radial-gradient(ellipse at 46% 90%, #383049, #211b31 60%); }
.eye { position: absolute; top: 32%; width: 21%; height: 35%; border-radius: 50%; background: #ffdb88; box-shadow: 0 0 .8cqw #ffc47655; transition: transform .22s; }
.eye.left { left: 22%; } .eye.right { right: 22%; }
.eye i { position: absolute; inset: 9% 27%; border-radius: 50%; background: #21182b; }
.eye i::after { content: ""; position: absolute; left: 14%; top: 14%; width: 39%; aspect-ratio: 1; border-radius: 50%; background: #fff2cf; }
.nose { position: absolute; left: 47%; top: 61%; width: 6%; height: 8%; background: #ef97ab; border-radius: 50% 50% 65% 65%; }
.mouth { position: absolute; left: 45%; top: 69%; width: 10%; height: 9%; border-bottom: .35cqw solid #c27f9d; border-radius: 50%; }
.collar { position: absolute; top: 72%; left: 26%; width: 48%; height: 12%; background: #e14559; border-radius: 30% 30% 50% 50%; }
.collar i { position: absolute; left: 45%; top: 50%; width: 12%; aspect-ratio: 1; border-radius: 50%; background: #ffcf6f; box-shadow: inset -.35cqw -.35cqw #c3812e; }
.paw { bottom: -1%; width: 23%; height: 16%; border-radius: 50%; box-shadow: inset 0 -.45cqw #443652; }
.paw.left { left: 13%; } .paw.right { right: 13%; }
.plinth { position: absolute; left: 39%; width: 22%; height: 6%; bottom: 3%; background: linear-gradient(#edbd84, #9a5f75 30%, #492e52); border-radius: 50%; }
button { color: inherit; font: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid #ffdc9b; outline-offset: 5px; }
.orb { position: absolute; display: grid; place-items: center; bottom: 6%; left: 41%; width: 18%; aspect-ratio: 1; border-radius: 50%; border: .35cqw solid #e9cdff; overflow: hidden; background: radial-gradient(circle at 31% 23%, #fff 0 2%, transparent 12%), radial-gradient(circle at 42% 39%, #e4d2ff, #a877e1 56%, #613c9c 88%); box-shadow: 0 0 3cqw #b27bff, inset -.5cqw -.65cqw 1.3cqw #64318b; transition: box-shadow .25s, scale .25s; }
.orb:hover { scale: 1.06; box-shadow: 0 0 5cqw #d6adff; }
.orb span { color: #fff1ff; font-size: 6cqw; text-shadow: 0 0 12px white; }
.room-shade, .orb-aura { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.room-shade { background: #150c2a; transition: opacity 1.65s ease; }
.orb-aura {
  background: radial-gradient(ellipse 33% 56% at 50% 77%, #9baeffa0, #9f6ce249 51%, transparent 82%);
  mix-blend-mode: screen;
  transition: opacity 1.65s ease;
}
.orb::after {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: conic-gradient(from 30deg, transparent 8%, #99c9ff99 26%, transparent 45%, #eac6ffbb 66%, transparent 85%);
  opacity: 0;
  transition: opacity 1.4s ease;
}
.orb span { position: relative; z-index: 1; }
.sparks { position: absolute; left: 50%; bottom: 21%; pointer-events: none; }
.sparks i {
  position: absolute;
  color: #e6d5ff;
  font: 3cqw serif;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.45);
  text-shadow: 0 0 1.3cqw #caa6ff;
  transition: opacity .95s ease, transform 2.2s ease-out;
}
.sparks i:nth-child(1) { --x: -16cqw; --y: -10cqw; --delay: .12s; }
.sparks i:nth-child(2) { --x: 13cqw; --y: -17cqw; --delay: .39s; }
.sparks i:nth-child(3) { --x: 21cqw; --y: -5cqw; --delay: .68s; }
.sparks i:nth-child(4) { --x: -24cqw; --y: -5cqw; --delay: .97s; }
.sparks i:nth-child(5) { --x: -10cqw; --y: -19cqw; --delay: 1.24s; }
.sparks i:nth-child(6) { --x: 24cqw; --y: -12cqw; --delay: 1.50s; }
.sparks i:nth-child(7) { --x: -22cqw; --y: -16cqw; --delay: .54s; font-size: 4cqw; }
.sparks i:nth-child(8) { --x: 17cqw; --y: -23cqw; --delay: 1.1s; font-size: 4cqw; }
.casting .room-shade { opacity: .32; }
.casting .orb-aura { opacity: .46; }
.casting .orb { cursor: wait; scale: 1; transition: box-shadow 1.45s ease; box-shadow: 0 0 4.6cqw #c69bff, inset 0 0 2cqw #a779e5; }
.casting .eye { transform: scaleY(.11); transition: transform 1.55s ease-in-out; }
.swirling .orb-aura { opacity: .88; transition-duration: 2.6s; }
.swirling .orb { box-shadow: 0 0 6.6cqw 1.3cqw #a59affba, inset 0 0 2cqw #90b6ff; transition-duration: 2.6s; }
.swirling .orb::after { opacity: .75; animation: spin 5s linear infinite; }
.swirling .sparks i {
  opacity: .8;
  transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1);
  transition-delay: var(--delay);
  animation: shimmer 2.4s ease-in-out var(--delay) infinite alternate;
}
.gathering .orb-aura { opacity: .98; transition-duration: 1.1s; }
.gathering .sparks i {
  animation: none;
  opacity: .28;
  transform: translate(calc(-50% + var(--x) * .27), calc(-50% + var(--y) * .27)) scale(.65);
  transition: opacity 1.2s ease, transform 1.35s ease-in;
}
.gathering .eye { transform: scale(1.18); transition-duration: 1.3s; }
.glint .orb { animation: glint .95s ease-out; }
.settling .room-shade, .settling .orb-aura { opacity: 0; transition-duration: .85s; }
.settling .orb::after, .settling .sparks i { opacity: 0; transition: opacity .85s ease; }
.settling .orb { box-shadow: 0 0 3cqw #b27bff, inset -.5cqw -.65cqw 1.3cqw #64318b; transition-duration: .85s; }
.settling .eye, .revealed .eye { transform: scale(1.12); transition-duration: .5s; }
.fortune-appears { animation: reveal .85s ease-out both; }
@keyframes flicker { to { transform: scale(.86, 1.12); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { filter: brightness(.88); } to { filter: brightness(1.3); } }
@keyframes glint {
  0%, 100% { filter: brightness(1); }
  36% { filter: brightness(1.38); }
}
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.sound {
  min-height: 44px;
  margin-top: 10px;
  padding: 5px 12px;
  border: 1px solid #846598;
  border-radius: 10px;
  background: #2b2040;
  font-size: .88rem;
}
.sound[aria-pressed="true"]::after { content: "　開"; color: #f4d69e; }
.sound[aria-pressed="false"]::after { content: "　關"; color: #cfbedc; }
.reading { text-align: center; padding: 20px 16px; border-top: 1px solid #76536f; }
#fortune { min-height: 2.9em; display: grid; place-items: center; margin: 0; font-size: clamp(1.05rem, 4vw, 1.35rem); line-height: 1.5; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }
.actions button { border: 1px solid #a684c4; background: #3b2856; padding: 9px 17px; min-height: 44px; border-radius: 12px; }
.actions button:first-child { background: #e4c2ff; color: #29173b; border-color: #e4c2ff; font-weight: bold; }
.actions button:hover { filter: brightness(1.15); }
#feedback { margin: 12px 0 0; color: #f4d69e; }
textarea { width: min(100%, 430px); margin-top: 8px; font: inherit; }
@media (max-width: 480px) { main { padding-top: 26px; } .scene { aspect-ratio: 1.45; } .cat { top: 22%; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
