:root {
  /* 색: 보라 밤하늘 + 촛불 금색 */
  --bg: #1b1030; --bg-deep: #120a22;
  --panel: rgba(42, 26, 72, .62); --panel-solid: #2a1a48; --panel-hi: rgba(58, 38, 96, .72);
  --border: rgba(232, 194, 107, .28); --border-hi: rgba(232, 194, 107, .7);
  --text: #f3ecff; --muted: #b9a8d9; --accent: #e8c26b; --accent-hi: #f3d58f; --violet: #a58bea;
  --free: #7fd6b4;
  /* 모양·움직임 */
  --r-sm: 8px; --r: 14px; --r-lg: 20px;
  --shadow: 0 8px 28px rgba(5, 2, 12, .45);
  --glow: 0 0 0 1px var(--border-hi), 0 0 22px rgba(232, 194, 107, .28);
  --ease: cubic-bezier(.2, .8, .2, 1); --ease-spring: cubic-bezier(.3, 1.4, .5, 1);
  --t-fast: .18s; --t: .3s;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-display: Cinzel, "Pretendard Variable", Pretendard, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere;
  font-family: var(--font); font-size: 16px; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 9%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 85% 42%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 33% 64%, #fff5 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 82%, #fff6 50%, transparent 51%),
    radial-gradient(ellipse at 50% -10%, #3b2470 0%, transparent 60%),
    radial-gradient(ellipse at 50% 120%, #2a1650 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}
main { max-width: 680px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 16px max(48px, env(safe-area-inset-bottom)); }
header { text-align: center; margin: 4px 0 12px; }
.brand { font-family: var(--font-display); color: var(--accent); letter-spacing: .16em; font-size: 14px; font-weight: 600; opacity: .9; }
h1 { font-size: 28px; line-height: 1.3; margin: 2px 0 0; color: var(--accent); font-weight: 700; letter-spacing: -.01em; }
h2 { text-align: center; margin: 8px 0 0; font-weight: 700; letter-spacing: -.01em; }
.sub { text-align: center; color: var(--muted); margin: 4px 0 20px; }
a { color: var(--accent); }
.menu { display: grid; gap: 12px; }

/* 버튼 */
button, a.button {
  font: inherit; font-size: 17px; font-weight: 600; min-height: 48px; padding: 14px 18px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--panel); color: var(--text); cursor: pointer;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast), box-shadow var(--t) var(--ease), background var(--t-fast);
}
@media (hover: hover) {
  button:hover, a.button:hover { border-color: var(--border-hi); box-shadow: var(--glow), var(--shadow); background: var(--panel-hi); }
}
button:active, a.button:active { transform: scale(.98); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-sm); }
a.button { display: block; text-align: center; text-decoration: none; }
button.ghost { background: transparent; box-shadow: none; font-size: 15px; font-weight: 500; padding: 12px 20px; -webkit-backdrop-filter: none; backdrop-filter: none; }
.hidden { display: none !important; }
.note { color: var(--muted); font-size: 13px; text-align: center; margin-top: 32px; }
.note a { color: var(--muted); }

/* 홈 메뉴 */
#menu > .sub { font-size: 15px; margin-bottom: 8px; }
button[data-mode=daily] {
  position: relative; overflow: hidden; padding: 22px 18px; font-size: 20px; font-weight: 700; color: var(--accent);
  border-color: var(--border-hi); border-radius: var(--r-lg);
  background: radial-gradient(120% 140% at 50% 0%, rgba(232, 194, 107, .18), transparent 60%), var(--panel);
}
button[data-mode=daily] small { display: block; margin-top: 4px; font-size: 14px; font-weight: 400; color: var(--muted); }
.spread { text-align: left; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; padding: 14px 16px; font-size: 16.5px; }
.spread::after { content: "›"; color: var(--accent); font-size: 22px; font-weight: 400; grid-column: 2; grid-row: 1 / span 2; }
.spread small {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--muted); font-size: 13.5px; font-weight: 400; margin-top: 4px; line-height: 1.5;
}

/* 스프레드 판 */
#board { position: relative; margin: 16px auto 8px; }
.slot { position: absolute; perspective: 800px; }
.slot .place {
  position: absolute; inset: 0; border: 1px dashed #e8c26b66; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; color: #e8c26b88; font-size: 13px;
}
.slot .flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.3,1.4,.5,1); opacity: 0; }
.slot.filled .flip { opacity: 1; }
.slot.flipped .flip { transform: rotateY(180deg); }
.slot.filled.ready { cursor: pointer; }
.slot.filled.ready:not(.flipped) .flip { animation: breathe 1.6s ease-in-out infinite; }
.face { position: absolute; inset: 0; border-radius: 6px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; box-shadow: 0 4px 14px #0009; }
.face.back { background: url(/static/card-back.svg) center / cover; }
.face.front { transform: rotateY(180deg); background: #000; }
.face.front img { width: 100%; height: 100%; display: block; }
.slot.flipped .face.front { box-shadow: 0 0 18px #e8c26b88, 0 4px 14px #0009; }
.slot .num {
  position: absolute; top: -9px; left: -9px; z-index: 2; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #1b1030; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.slot .cap { position: absolute; left: -20px; right: -20px; top: 100%; margin-top: 6px; text-align: center; font-size: 13px; color: var(--muted); }
@keyframes breathe { 50% { filter: drop-shadow(0 0 8px #e8c26b); } }

/* 덱 */
.hint { text-align: center; color: var(--accent); min-height: 1.6em; margin: 8px 0; }
#deck { position: relative; margin: 0 auto; transition: height .6s, opacity .6s, transform .5s var(--ease); }
#deck.shuffling::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px;
  border-radius: 50%; background: radial-gradient(circle, #e8c26b33, transparent 70%); animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.25); opacity: .6; } }
#deck.gone { pointer-events: none; overflow: hidden; }
.dcard {
  position: absolute; left: 0; top: 0; border-radius: 5px; background: url(/static/card-back.svg) center / cover;
  box-shadow: 0 2px 6px #000a; will-change: transform; transition: filter .15s;
}
#deck.picking #deck.gone { pointer-events: none; overflow: hidden; }
.dcard { cursor: pointer; }
@media (hover: hover) { #deck.picking .dcard:hover { filter: brightness(1.35) drop-shadow(0 0 6px #e8c26b); } }
#deck.picking .dcard:active { filter: brightness(1.4) drop-shadow(0 0 8px #e8c26b); }
.dcard.taken { visibility: hidden; }
.flyer { position: fixed; z-index: 50; border-radius: 6px; background: url(/static/card-back.svg) center / cover; box-shadow: 0 0 24px #e8c26baa; pointer-events: none; }
.actions { display: flex; gap: 12px; justify-content: center; margin: 16px 0; }

/* 해석 */
.reading { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: rise .6s var(--ease) both; }
.reading p { font-size: 16.5px; line-height: 1.8; }
.reading h3 { margin: 0 0 8px; color: var(--accent); font-size: 18px; line-height: 1.4; }
.reading p { white-space: pre-line; margin: 0; }
.reading .desc { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
#readings > .link { margin: -4px 0 14px 14px; padding-left: 12px; border-left: 2px solid var(--accent); color: var(--muted); font-size: 15px; }
.reading.extra { animation-delay: .3s; }
.reading .questions { margin: 0; padding-left: 20px; }
.reading .questions li + li { margin-top: 6px; }
.reading.lucky .buy { display: inline-block; margin-top: 10px; padding: 10px 16px; border: 1px solid var(--accent); border-radius: 10px; color: var(--accent); text-decoration: none; }
.reading.lucky .disclosure { color: var(--muted); font-size: 12px; margin-top: 8px; }
#readings > .word { text-align: center; color: var(--accent); font-size: 19px; font-weight: 700; margin: 24px 0 8px; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* 마음 모으기 */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: 0; transition: opacity 1.2s;
  background:
    radial-gradient(1px 1px at 20% 30%, #fffc 50%, transparent 51%),
    radial-gradient(1px 1px at 80% 20%, #fffa 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 60% 70%, #fffb 50%, transparent 51%),
    radial-gradient(1px 1px at 35% 85%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 60%, #fffa 50%, transparent 51%),
    radial-gradient(ellipse at 50% 40%, transparent 30%, #05020cdd 100%);
  animation: twinkle 6s ease-in-out infinite;
}
body.immersed::before { opacity: 1; }
body.immersed header .brand, body.immersed .note { opacity: .25; transition: opacity 1s; }
body.immersed h1 { font-size: 20px; transition: font-size .6s; }
@keyframes twinkle { 50% { filter: brightness(.6); } }
.focus { text-align: center; padding: 28px 8px 8px; transition: opacity .6s; }
.focus.leaving { opacity: 0; }
.orb { width: 150px; height: 150px; margin: 8px auto 28px; display: flex; align-items: center; justify-content: center; }
.orb span {
  width: 70px; height: 70px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff3cf, #e8c26b 45%, #8a5fd0 100%);
  box-shadow: 0 0 40px #e8c26b88, 0 0 90px #8a5fd055;
  animation: breath 8s ease-in-out infinite;
}
@keyframes breath { 0%, 100% { transform: scale(.75); opacity: .75; } 50% { transform: scale(1.6); opacity: 1; } }
.focus-text { font-size: 19px; min-height: 3.2em; margin: 0 0 6px; color: var(--text); }
.focus-text.fade { animation: rise .9s both; }
.focus-tip { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
button.ready { min-width: 180px; animation: rise .8s both; }
button.link { display: block; margin: 14px auto 0; background: none; border: 0; color: var(--muted); font-size: 13px; padding: 6px; text-decoration: underline; }
button.link:hover { background: none; color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .orb span, body::before { animation: none; }
  .slot .flip { transition-duration: .01s; }
  #deck.shuffling::before, .slot.filled.ready:not(.flipped) .flip { animation: none; }
}
.reading .card-img { display: block; width: 120px; margin: 8px auto 12px; border-radius: 8px; }
.reading .pos, .reading .kw { color: var(--muted); font-size: 14px; margin: 0 0 6px; }
.reading p + p { margin-top: 8px; }
.badge { display: inline-block; vertical-align: 2px; font-size: 12px; font-weight: 700; line-height: 1; padding: 4px 8px; margin-left: 6px; border-radius: 999px; color: var(--free); background: rgba(127, 214, 180, .12); border: 1px solid rgba(127, 214, 180, .45); }
.badge.price { color: var(--accent); background: rgba(232, 194, 107, .12); border-color: var(--border-hi); }
input[type=date] { width: 100%; min-height: 48px; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--text); color-scheme: dark; background: var(--panel); border-radius: var(--r); border: 1px solid var(--border); margin-bottom: 10px; box-sizing: border-box; }
input[type=date]:focus { outline: none; border-color: var(--border-hi); box-shadow: var(--glow); }
.brand a { color: inherit; text-decoration: none; }

/* 2단계: 스프레드 화면 → 해설 화면 */
#board .slot { transition: left .5s, top .5s, width .5s, height .5s; }
button.primary { background: linear-gradient(180deg, var(--accent-hi), var(--accent)); color: #1b1030; border-color: transparent; font-weight: 700; min-width: 220px; box-shadow: 0 6px 24px rgba(232, 194, 107, .35); animation: rise .6s var(--ease) both; }
@media (hover: hover) { button.primary:hover { background: var(--accent-hi); color: #1b1030; } }
.actions.top { margin-top: 8px; }
.reading .head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.reading .head h3 { margin: 0; }
.reading .thumb { width: 44px; flex: none; border-radius: 4px; box-shadow: 0 2px 8px #0008; }
.calc { color: var(--muted); font-size: 13px; margin: 0 0 6px; font-variant-numeric: tabular-nums; }
.reading h4 { margin: 14px 0 4px; font-size: 15px; color: var(--accent); }
.reading details { margin-top: 12px; border-top: 1px solid #e8c26b33; padding-top: 8px; }
.reading details summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.reading details.number summary::before { content: "🔢 "; }

.reading .symbols { margin-top: 12px; padding-top: 10px; border-top: 1px dashed rgba(255,255,255,.15); }
.reading .sym-title { margin: 0 0 6px; font-size: 14px; color: var(--accent); }
.reading .sym-main, .reading .sym-more { font-size: 15px; }
.reading details summary { cursor: pointer; color: var(--muted); font-size: 14px; margin-top: 8px; }
.reading .sym-more { margin-top: 8px !important; }

.reading .birthline { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 215, 120, .1); }
.reading .birthline h4 { margin: 0 0 4px; color: var(--accent); font-size: 15px; }
.reading .birthline .calc { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.reading .birthline p { font-size: 15px; }
.remember { display: block; margin-top: 10px; }
button.link { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 6px 0; cursor: pointer; }
.reading .weave { margin-top: 10px !important; }

/* 카드 해석 페이지 */
.cardpage h1 { font-size: 24px; margin: 8px 0 16px; line-height: 1.35; }
.cardpage h2 { color: var(--accent); font-size: 20px; margin: 28px 0 8px; }
.cardpage h3 { font-size: 16px; margin: 16px 0 4px; color: var(--text); }
.cardpage p, .cardpage li { line-height: 1.7; }
.cardpage a { color: var(--accent); }
.cardpage .crumbs { font-size: 14px; color: var(--muted); }
.cardpage .card-big { display: block; width: 220px; height: auto; margin: 8px auto 16px; border-radius: 10px; box-shadow: 0 6px 20px #0008; }
.cardpage .kw, .cardpage .muted { color: var(--muted); }
.cardpage .yesno ul, .cardpage .syms { padding-left: 18px; }
.cardpage .syms li { margin-bottom: 10px; }
.cardpage .cta { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; margin: 24px 0; text-align: center; }
.cardpage .cta h2 { margin-top: 0; }
.cardpage .cta .button { display: inline-block; text-decoration: none; }
.cardpage .pager { display: flex; justify-content: space-between; margin-top: 24px; font-size: 15px; }
.cardgrid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.cardgrid a { display: block; text-align: center; text-decoration: none; color: var(--text); font-size: 13px; }
.cardgrid img { width: 100%; height: auto; border-radius: 6px; display: block; margin-bottom: 4px; box-shadow: 0 4px 12px #0008; transition: transform var(--t) var(--ease), box-shadow var(--t); }
@media (hover: hover) { .cardgrid a:hover img { transform: translateY(-4px); box-shadow: 0 0 18px rgba(232, 194, 107, .35), 0 6px 16px #0009; } }
.reading .cardlink { display: inline-block; margin-top: 10px; color: var(--muted); font-size: 14px; }

/* 유리 효과를 못 쓰는 브라우저는 단색 패널 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --panel: var(--panel-solid); --panel-hi: #3a2660; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  button, a.button, .cardgrid img { transition: none; }
}
@media (min-width: 720px) {
  h1 { font-size: 32px; }
}

/* 화면 바뀔 때 부드럽게 */
#menu:not(.hidden), #ritual:not(.hidden), #readingView:not(.hidden) { animation: enter var(--t) var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }
.dcard:focus-visible, .slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; vertical-align: -3px; }

/* 직접 섞기 · 덱 나누기 */
#deck.hand { touch-action: none; cursor: grab; }
#deck.hand:active { cursor: grabbing; }
#deck.hand::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; margin: -110px 0 0 -110px; z-index: -1;
  border-radius: 50%; background: radial-gradient(circle, rgba(232, 194, 107, .22), transparent 70%); animation: pulse 2.4s ease-in-out infinite;
}
#deck .pile {
  position: absolute; z-index: 200; padding: 0; min-height: 0; border: 1px dashed transparent; border-radius: 10px;
  background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
}
@media (hover: hover) { #deck .pile:hover { border-color: var(--border-hi); box-shadow: var(--glow); background: transparent; } }
#deck .pile:active { transform: none; border-color: var(--border-hi); box-shadow: var(--glow); }
#spreadActions { flex-wrap: wrap; }
#spreadActions button.link { flex-basis: 100%; text-align: center; margin: 0; }
.slot { touch-action: pan-y; }
#deck.hand, #deck.cutting { transform: scale(1.45); }
button.link { box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; min-height: 44px; font-weight: 500; }
@media (hover: hover) { button.link:hover { box-shadow: none; background: none; } }
#spreadActions { position: relative; z-index: 5; }
#deck.cutting { pointer-events: none; }
#deck.cutting .pile { pointer-events: auto; }

/* 카테고리 홈 */
.cat-nav { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; margin: 8px -16px 0; padding-left: 16px; padding-right: 16px; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: 16px; }
.cat-nav::-webkit-scrollbar { display: none; }
.chip { flex: none; scroll-snap-align: start; padding: 9px 14px; min-height: 40px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font-size: 14.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
@media (hover: hover) { .chip:hover { border-color: var(--border-hi); } }
.category { margin-top: 28px; scroll-margin-top: 16px; }
.cat-title { text-align: left; font-size: 19px; margin: 0 0 12px; color: var(--accent); }
.menu-grid { display: grid; gap: 10px; }
.menu-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; text-align: left;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r); background: var(--panel); color: var(--text);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--shadow);
}
.mc-title { font-size: 16.5px; font-weight: 700; line-height: 1.45; }
.mc-sub { font-size: 13.5px; color: var(--muted); font-weight: 400; }
.mc-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.mc-meta .badge { margin-left: 0; }
.mc-count { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.soon { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.soon::before { content: "🔒 "; }
.menu-card.locked { box-shadow: none; opacity: .88; }
.menu-card.locked .mc-title { color: #d9cdee; }
@media (min-width: 720px) { .menu-grid { grid-template-columns: 1fr 1fr; } .cat-nav { justify-content: center; flex-wrap: wrap; } }

/* 사업자 정보 푸터 · 약관 페이지 */
.site-footer { max-width: 680px; margin: 8px auto 0; padding: 20px 16px max(28px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(232, 194, 107, .15); color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }
.site-footer p { margin: 6px 0; }
.site-footer nav { font-size: 13px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }
body.immersed .site-footer { opacity: .25; transition: opacity 1s; }
.legal h2 { text-align: left; font-size: 17px; }
.legal ul { padding-left: 20px; }
