:root {
  color-scheme: dark;
  --bg: #07080b;
  --panel: rgba(18, 22, 30, 0.74);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f4f1ea;
  --muted: #aeb4bd;
  --wood: #67d18f;
  --fire: #ff6b4a;
  --earth: #d7b46a;
  --metal: #dfe6ef;
  --water: #5fb8ff;
  --violet: #b59cff;
  --warn: #ff8a73;
  --font-serif: "Noto Serif KR", "Batang", "바탕", Georgia, serif;
  --font-sans: Inter, "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font: 16px/1.7 var(--font-sans);
  background:
    radial-gradient(circle at 14% 20%, rgba(95, 184, 255, 0.16), transparent 28%),
    radial-gradient(circle at 86% 22%, rgba(255, 107, 74, 0.12), transparent 26%),
    linear-gradient(135deg, #08090d 0%, #111218 46%, #06080b 100%);
  background-attachment: fixed;
}
b { color: var(--earth); font-weight: 700; }

/* 배경 */
.sky {
  position: fixed; inset: 0; z-index: -3;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.78) 0 1px, transparent 1.3px),
    radial-gradient(circle, rgba(255,255,255,0.35) 0 1px, transparent 1.2px);
  background-size: 92px 92px, 138px 138px;
  background-position: 10px 16px, 52px 44px;
  opacity: 0.28;
  animation: drift 90s linear infinite;
}
.orbit-grid {
  position: fixed; inset: -25vmax; z-index: -2; pointer-events: none;
  background: repeating-radial-gradient(circle at center, rgba(255,255,255,0.10) 0 1px, transparent 1px 76px);
  transform: rotateX(68deg) rotateZ(-18deg);
  opacity: 0.35;
  animation: orbit 160s linear infinite;
}
@keyframes drift { to { background-position: 102px 108px, 190px 182px; } }
@keyframes orbit { to { transform: rotateX(68deg) rotateZ(342deg); } }

.shell { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 40px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 720; color: inherit; text-decoration: none; }
.brand:focus-visible { outline: 2px solid var(--earth); outline-offset: 4px; border-radius: 6px; }
.top-link {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); background: rgba(255,255,255,0.05);
  font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap;
  transition: border-color .2s, background .2s;
}
.top-link:hover { border-color: var(--earth); background: rgba(215,180,106,0.12); }
.top-link:focus-visible { outline: 2px solid var(--earth); outline-offset: 3px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(244,241,234,0.24);
  background: conic-gradient(from 30deg, var(--wood), var(--fire), var(--earth), var(--metal), var(--water), var(--wood));
  box-shadow: 0 0 28px rgba(95,184,255,0.25);
  animation: spin 24s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px; margin-bottom: 18px;
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px;
  color: #cdd6df; background: rgba(255,255,255,0.05); font-size: 13px;
}
.pulse {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--wood); box-shadow: 0 0 18px var(--wood);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; transform: scale(.7); } }

/* 히어로 */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 24px; margin-bottom: 36px; }
h1 { margin: 0; font-size: clamp(46px, 5vw, 68px); line-height: 0.94; font-weight: 800; letter-spacing: 0; }
h1 span { display: block; white-space: nowrap; }
h1 span:last-child { color: var(--earth); font-family: var(--font-serif); font-weight: 700; }
.lead { margin: 22px 0 0; max-width: 440px; color: #c9ced6; font-size: 18px; line-height: 1.7; word-break: keep-all; }

.stage { position: relative; height: 380px; perspective: 1100px; }
.ring {
  position: absolute; left: 50%; top: 50%; width: 80%; height: 80%;
  border: 1px solid rgba(255,255,255,0.16); border-radius: 50%; opacity: 0.42;
  transform: translate(-50%, -50%) rotateX(67deg) rotateZ(-12deg); pointer-events: none;
  animation: ring 30s linear infinite;
}
.ring:nth-child(2) {
  width: 62%; height: 62%; border-color: rgba(215,180,106,0.28);
  transform: translate(-50%, -50%) rotateX(71deg) rotateZ(22deg);
  animation-duration: 22s; animation-direction: reverse;
}
@keyframes ring { to { transform: translate(-50%, -50%) rotateX(67deg) rotateZ(348deg); } }

.float-card {
  position: absolute; left: 50%; top: 50%; width: 150px; aspect-ratio: 7 / 12;
  margin: -128px 0 0 -75px;
  transform: var(--base);
  animation: float 7s ease-in-out infinite;
}
.float-card.c1 { --base: translateX(-110px) rotate(-14deg); animation-delay: -1.5s; }
.float-card.c2 { --base: translateY(-18px); z-index: 1; }
.float-card.c3 { --base: translateX(110px) rotate(14deg); animation-delay: -3.5s; }
@keyframes float {
  0%, 100% { transform: var(--base) translateY(0); }
  50% { transform: var(--base) translateY(-14px); }
}

/* 카드 뒷면 */
.back-art {
  position: relative; width: 100%; height: 100%; border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(215,180,106,0.55);
  background:
    radial-gradient(circle at 50% 50%, transparent 0 26%, rgba(215,180,106,0.5) 26.5% 27.5%, transparent 28%),
    radial-gradient(circle at 50% 50%, transparent 0 38%, rgba(215,180,106,0.22) 38.5% 39%, transparent 39.5%),
    conic-gradient(from 0deg at 50% 50%, rgba(103,209,143,.18), rgba(255,107,74,.18), rgba(215,180,106,.2), rgba(223,230,239,.14), rgba(95,184,255,.2), rgba(103,209,143,.18)),
    linear-gradient(160deg, #161a24, #0b0d13);
  box-shadow: inset 0 0 0 5px #0d1017, inset 0 0 0 6px rgba(215,180,106,0.35), 0 18px 40px rgba(0,0,0,0.45);
}
.back-art::before {
  content: "✦"; position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--earth); font-size: 22px; text-shadow: 0 0 14px rgba(215,180,106,.7);
}
.back-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 30%), rgba(255,255,255,0.28), transparent 45%);
  opacity: var(--glare, 0); transition: opacity .3s;
}

/* 3D 틸트 */
.tilt {
  transform-style: preserve-3d;
  transition: transform .5s var(--ease);
}
.tilt.is-tilting { transition: transform .08s linear; }
.tilt > .back-art, .tilt > .flip-inner {
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .5s var(--ease);
}
.tilt.is-tilting > .back-art, .tilt.is-tilting > .flip-inner { transition: transform .08s linear; }

/* 패널·폼 */
.panel {
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
}
.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; color: #f8f6f1; font-size: 15px; font-weight: 740; }
.date-chip { color: #101319; background: var(--earth); border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 800; }

.ask { max-width: 640px; margin: 0 auto; padding: 24px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 14px; color: #cdd6df; }
textarea, select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: rgba(0,0,0,0.35); color: var(--text); font: 16px/1.6 var(--font-sans);
  transition: border-color .2s, box-shadow .2s;
}
textarea:focus, select:focus { outline: none; border-color: var(--earth); box-shadow: 0 0 0 3px rgba(215,180,106,0.18); }
.chips { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { padding: 0; margin-bottom: 8px; font-size: 14px; color: #cdd6df; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; }
.chips span {
  display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.chips input:checked + span { background: var(--earth); color: #101319; border-color: var(--earth); font-weight: 700; }
.chips input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }
.hint { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.warn { margin: 0; padding: 12px 14px; border: 1px solid rgba(255,138,115,.4); border-radius: 6px; color: var(--warn); background: rgba(255,107,74,.08); }

.cta {
  min-height: 48px; border: 0; border-radius: 6px; padding: 0 20px;
  color: #081015; background: #f4f1ea; font: 720 16px var(--font-sans); cursor: pointer;
  position: relative; overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s;
}
.cta::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(215,180,106,.55) 50%, transparent 70%);
  transform: translateX(-100%); transition: transform .7s var(--ease);
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(215,180,106,.25); }
.cta:hover::after { transform: translateX(100%); }
.cta:focus-visible { outline: 2px solid var(--earth); outline-offset: 3px; }
.cta.ghost { display: block; margin: 32px auto 0; background: transparent; color: var(--text); border: 1px solid var(--line); }
.tips { color: var(--muted); font-size: 14px; }
.tips summary { cursor: pointer; }

/* 카드 고르기 */
.step-head { text-align: center; margin-bottom: 24px; }
.q-echo { margin: 0 auto; max-width: 640px; font: 600 clamp(20px, 3vw, 26px)/1.5 var(--font-serif); word-break: keep-all; }
.slots { list-style: none; padding: 0; margin: 0 auto 28px; display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.slot {
  width: 72px; display: grid; gap: 6px; justify-items: center; text-align: center;
  font-size: 12px; color: var(--muted); line-height: 1.3; word-break: keep-all;
}
.slot .hole {
  width: 72px; aspect-ratio: 7 / 12; border-radius: 8px;
  border: 1px dashed rgba(215,180,106,0.35); background: rgba(255,255,255,0.02);
}
.slot.filled .hole { border: 0; animation: land .55s var(--ease); }
.slot.filled .hole .back-art { box-shadow: 0 0 24px rgba(215,180,106,.35); }
@keyframes land { from { transform: translateY(-30px) scale(1.2) rotate(-8deg); opacity: 0; } }

.deck {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 10px;
  perspective: 900px;
}
.deck .card {
  aspect-ratio: 7 / 12; padding: 0; border: 0; background: none; cursor: pointer;
  animation: riffle .9s var(--ease) both; animation-delay: calc(var(--i) * 8ms);
}
.deck .card .back-art { transition: transform .35s var(--ease), box-shadow .35s; }
.deck .card:hover .back-art, .deck .card:focus-visible .back-art {
  box-shadow: inset 0 0 0 5px #0d1017, inset 0 0 0 6px rgba(215,180,106,0.6), 0 16px 34px rgba(215,180,106,0.25);
}
.deck .card:hover .back-art { transform: translateY(-6px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.deck .card:focus-visible { outline: 2px solid var(--earth); outline-offset: 3px; border-radius: 10px; }
.deck .card.taken { pointer-events: none; animation: take .45s var(--ease) forwards; }
@keyframes riffle {
  0% { opacity: 0; transform: translate(var(--sx), var(--sy)) rotate(var(--sr)); }
  60% { opacity: 1; transform: translate(calc(var(--sx) * -.15), calc(var(--sy) * -.15)) rotate(calc(var(--sr) * -.3)); }
  100% { opacity: 1; transform: none; }
}
@keyframes take { to { opacity: .12; transform: translateY(-24px) scale(.85); } }

/* 결과 */
.result { list-style: none; padding: 0; margin: 0; display: grid; gap: 22px; }
.reading {
  display: grid; grid-template-columns: 200px 1fr; gap: 28px; padding: 24px;
  opacity: 0; transform: translateY(30px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.reading.in { opacity: 1; transform: none; }
.flip { width: 100%; aspect-ratio: 7 / 12; perspective: 1200px; }
.flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.flip-rot {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform 1.1s var(--ease);
}
.flip.open .flip-rot { transform: rotateY(180deg); }
.flip .side { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip .side.face { transform: rotateY(180deg); border-radius: 10px; overflow: hidden; box-shadow: 0 20px 44px rgba(0,0,0,.5); }
.flip .side.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.flip .side.face.rev img { transform: rotate(180deg); }
.flip .side.face::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 30%), rgba(255,255,255,0.3), transparent 50%);
  opacity: var(--glare, 0); transition: opacity .3s; mix-blend-mode: soft-light;
}

.body { align-self: center; }
.pos { margin: 0 0 6px; color: var(--earth); font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.body h2 { margin: 0; font: 700 clamp(24px, 3vw, 30px)/1.25 var(--font-serif); }
.body h2 small { margin-left: 8px; font: 500 14px var(--font-sans); color: var(--muted); }
.en { margin: 4px 0 12px; color: var(--muted); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.kw { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.kw li { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: #cdd6df; }
.body p { margin: 0 0 10px; color: #dcdfe4; word-break: keep-all; }
.note { padding: 10px 14px; border-left: 2px solid var(--earth); background: rgba(215,180,106,.06); border-radius: 0 6px 6px 0; }
.note strong { display: block; margin-bottom: 2px; color: var(--earth); font-size: 13px; }

/* 스크롤 등장 */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* 카테고리 */
.section-head { text-align: center; margin: 12px 0 22px; }
.section-head h2 { margin: 0; font: 700 clamp(24px, 3.4vw, 32px)/1.3 var(--font-serif); }
.categories {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px;
  margin-bottom: 28px; perspective: 1000px;
}
.cat { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.cat-inner {
  position: relative; height: 100%; display: grid; gap: 6px; align-content: start;
  padding: 20px 18px 18px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .5s var(--ease), border-color .3s, box-shadow .3s;
}
.cat.is-tilting .cat-inner { transition: transform .08s linear, border-color .3s, box-shadow .3s; }
.cat-inner::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 30%), rgba(215,180,106,0.18), transparent 50%);
  opacity: var(--glare, 0); transition: opacity .3s;
}
.cat:hover .cat-inner, .cat.active .cat-inner { border-color: rgba(215,180,106,0.6); box-shadow: 0 18px 40px rgba(0,0,0,.35), 0 0 0 1px rgba(215,180,106,.25); }
.cat:focus-visible { outline: none; }
.cat:focus-visible .cat-inner { outline: 2px solid var(--earth); outline-offset: 3px; }
.cat-mark {
  width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 6px;
  border: 1px solid rgba(215,180,106,0.45); border-radius: 50%;
  color: var(--earth); font: 600 20px var(--font-serif);
  background: radial-gradient(circle, rgba(215,180,106,.14), transparent 70%);
}
.cat strong { font-size: 17px; font-weight: 800; }
.cat-desc { color: var(--muted); font-size: 14px; line-height: 1.55; word-break: keep-all; }
.cat-count {
  justify-self: start; margin-top: 6px; padding: 3px 9px; border-radius: 999px;
  color: #101319; background: var(--earth); font-size: 12px; font-weight: 800;
}
.cat.active .cat-count { background: var(--wood); }
.ask.pop { animation: pop .6s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.custom-fields { display: grid; gap: 14px; }

/* 예/아니오 */
.verdict { max-width: 520px; margin: 0 auto 22px; padding: 22px; text-align: center; animation: pop .8s var(--ease) .6s both; }
.verdict .v-label { color: var(--muted); font-size: 13px; letter-spacing: .08em; }
.verdict strong { display: block; margin: 4px 0 6px; font: 700 clamp(34px, 6vw, 48px)/1.2 var(--font-serif); }
.verdict p { margin: 0; color: #dcdfe4; word-break: keep-all; }
.verdict.yes strong { color: var(--wood); }
.verdict.no strong { color: var(--fire); }
.verdict.maybe strong { color: var(--earth); }

.foot { margin-top: 56px; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  h1 { font-size: clamp(34px, 9vw, 46px); }
  h1 span { white-space: normal; }
  .stage { height: 280px; order: -1; }
  .float-card { width: 110px; margin: -94px 0 0 -55px; }
  .float-card.c1 { --base: translateX(-80px) rotate(-14deg); }
  .float-card.c3 { --base: translateX(80px) rotate(14deg); }
  .reading { grid-template-columns: 1fr; gap: 18px; padding: 18px; }
  .flip { max-width: 200px; margin: 0 auto; }
  .deck { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
  .slot, .slot .hole { width: 52px; }
  .slots { gap: 8px; }
  .categories { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cat-inner { padding: 16px 14px 14px; }
  .cat-mark { width: 36px; height: 36px; font-size: 17px; }
  .cat strong { font-size: 15px; }
  .cat-desc { font-size: 13px; }
  .ask { padding: 18px; }
  .top { margin-bottom: 24px; }
  .q-echo { font-size: 19px; }
}

/* 동작 줄이기 설정: 큰 움직임만 페이드로 바꾸고, 작은 움직임(떠 있는 카드·기울기·뒤집기)은 남긴다 */
@media (prefers-reduced-motion: reduce) {
  :root:not(.force-motion) { scroll-behavior: auto; }
  :root:not(.force-motion) .sky,
  :root:not(.force-motion) .orbit-grid,
  :root:not(.force-motion) .ring,
  :root:not(.force-motion) .brand-mark { animation: none; }
  :root:not(.force-motion) .float-card { animation-duration: 10s; }
  :root:not(.force-motion) .deck .card { animation: fade-in .5s ease both; animation-delay: calc(var(--i) * 4ms); }
  :root:not(.force-motion) .deck .card.taken { animation: dim .3s ease forwards; }
  :root:not(.force-motion) .slot.filled .hole,
  :root:not(.force-motion) .ask.pop,
  :root:not(.force-motion) .verdict { animation: fade-in .5s ease both; }
  :root:not(.force-motion) .reveal,
  :root:not(.force-motion) .reading { transform: none; }
  :root:not(.force-motion) .cta:hover { transform: none; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes dim { to { opacity: .12; } }
