:root {
  color-scheme: light;
  --ink: #302744;
  --muted: #756d84;
  --paper: #fbf9ff;
  --card: rgba(255, 255, 255, .86);
  --line: rgba(93, 71, 127, .14);
  --purple: #8063b5;
  --purple-deep: #65499b;
  --lavender-soft: #eee7f8;
  --gold: #b69555;
  --serif: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  --shadow: 0 18px 50px rgba(72, 52, 105, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: linear-gradient(145deg, #fffdfa 0%, var(--paper) 45%, #f7f2fb 100%); color: var(--ink); font-family: var(--sans); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .32; background-image: radial-gradient(rgba(95, 73, 130, .17) .6px, transparent .6px); background-size: 20px 20px; mask-image: linear-gradient(to bottom, #000, transparent 42%); }
button, textarea, input { font: inherit; }
button { min-height: 44px; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
a { color: var(--purple-deep); }
.ambient { position: fixed; width: 420px; height: 420px; pointer-events: none; border-radius: 50%; filter: blur(4px); opacity: .5; z-index: -1; }
.ambient-one { top: 90px; right: -190px; background: radial-gradient(circle, rgba(213, 195, 238, .65), transparent 68%); }
.ambient-two { top: 620px; left: -260px; background: radial-gradient(circle, rgba(241, 214, 222, .55), transparent 68%); }

.site-header { position: relative; z-index: 10; width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 11px; color: var(--ink); text-decoration: none; align-items: center; }
.brand-mark { width: 38px; height: 38px; border: 1px solid rgba(128, 99, 181, .35); background: rgba(255,255,255,.58); border-radius: 50%; display: grid; place-items: center; color: var(--purple); font-size: 20px; }
.brand strong, .brand small { display: block; }
.brand strong { font: 600 16px var(--serif); letter-spacing: .12em; }
.brand small { color: var(--muted); font-size: 9px; letter-spacing: .16em; margin-top: 3px; }
nav { display: flex; gap: 4px; padding: 4px; background: rgba(255,255,255,.48); border: 1px solid rgba(255,255,255,.8); border-radius: 999px; }
.nav-link { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 8px 14px; border-radius: 999px; font-size: 13px; }
.nav-link:hover, .nav-link.active { background: #fff; color: var(--purple-deep); box-shadow: 0 3px 12px rgba(72,52,105,.09); }

main { position: relative; width: min(1020px, calc(100% - 40px)); margin: 0 auto; }
.view { display: none; animation: fade-in .35s ease; }
.view.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }
.hero { padding: 64px 0 32px; display: grid; grid-template-columns: minmax(0, 1fr) 270px; align-items: end; gap: 54px; }
.hero-copy { max-width: 690px; }
.eyebrow { margin: 0; color: var(--purple); font-size: 10px; letter-spacing: .26em; font-weight: 750; }
h1, h2, h3 { font-family: var(--serif); font-weight: 550; }
.hero h1 { max-width: 680px; font-size: clamp(38px, 5.4vw, 61px); line-height: 1.22; letter-spacing: -.035em; margin: 14px 0 16px; }
.hero h1 em { display: block; font-style: normal; color: var(--purple-deep); }
.lead { margin: 0; max-width: 560px; color: var(--muted); line-height: 1.8; font-family: var(--serif); font-size: 15px; }
.daily-note { padding: 18px 0 4px 22px; border-left: 1px solid rgba(128,99,181,.28); color: var(--muted); }
.daily-note span { color: var(--gold); font-size: 10px; letter-spacing: .18em; }
.daily-note p { margin: 9px 0 0; font: 13px/1.75 var(--serif); }

.reading-panel { overflow: hidden; background: var(--card); border: 1px solid rgba(255,255,255,.95); border-radius: 20px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.form-section { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 18px; margin: 0; padding: 25px 28px; border: 0; border-bottom: 1px solid var(--line); }
.step-number { padding-top: 3px; color: var(--purple); font-size: 10px; letter-spacing: .1em; }
.section-body { min-width: 0; }
.reading-panel label[for="question"], legend { display: block; color: var(--ink); font: 550 17px var(--serif); }
.section-hint { margin: 5px 0 16px; color: var(--muted); font-size: 12px; }
textarea { width: 100%; resize: vertical; color: var(--ink); background: rgba(247,244,250,.72); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; line-height: 1.65; outline: none; margin-top: 10px; }
textarea::placeholder { color: #a29aaa; }
textarea:focus { background: #fff; border-color: rgba(128,99,181,.55); box-shadow: 0 0 0 3px rgba(128,99,181,.08); }
.spread-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.spread-option { min-width: 0; }
.spread-option input { position: absolute; opacity: 0; }
.spread-option span { min-height: 98px; display: flex; flex-direction: column; padding: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.6); border-radius: 12px; cursor: pointer; transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.spread-option span:hover { transform: translateY(-1px); border-color: rgba(128,99,181,.3); }
.spread-option i { align-self: flex-end; margin-bottom: 2px; color: var(--purple); font-style: normal; font-size: 10px; }
.spread-option strong { font: 550 15px var(--serif); }
.spread-option small { color: var(--muted); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spread-option input:focus-visible + span { outline: 3px solid rgba(128,99,181,.2); }
.spread-option input:checked + span { border-color: rgba(128,99,181,.55); background: var(--lavender-soft); box-shadow: inset 0 0 0 1px rgba(255,255,255,.65); }
.more-spreads { margin-top: 12px; }
.more-spreads summary { color: var(--purple-deep); cursor: pointer; list-style: none; font-size: 12px; }
.more-spreads summary::-webkit-details-marker { display: none; }
.more-spreads summary::before { content: "+"; display: inline-grid; width: 22px; height: 22px; margin-right: 7px; place-items: center; background: var(--lavender-soft); border-radius: 50%; }
.more-spreads[open] summary::before { content: "−"; }
.more-spreads summary span { margin-left: 6px; color: var(--muted); }
.advanced-spreads { grid-template-columns: repeat(2, 1fr); margin-top: 10px; }
.reading-actions { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 28px; }
.toggle-row { flex: 1; display: flex; justify-content: flex-start; align-items: center; gap: 14px; }
.toggle-row > span { display: flex; flex-direction: column; }
.toggle-row strong { font-size: 13px; }
.toggle-row small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.toggle-row input { order: -1; width: 42px; height: 23px; accent-color: var(--purple); }
.primary-button, .secondary-button { border: 0; cursor: pointer; border-radius: 999px; padding: 13px 20px; font-weight: 650; }
.primary-button { min-width: 210px; display: flex; justify-content: space-between; gap: 45px; background: var(--purple); color: #fff; box-shadow: 0 9px 24px rgba(101,73,155,.2); }
.primary-button:hover { background: var(--purple-deep); }
.secondary-button { background: #fff; border: 1px solid rgba(128,99,181,.35); color: var(--purple-deep); }
.secondary-button:hover { background: var(--lavender-soft); }

.reading-result { padding: 76px 0 34px; }
.result-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 24px; }
.result-heading h2 { font-size: 36px; margin: 8px 0 5px; }
.result-tip { margin: 0; color: var(--muted); font-size: 13px; }
.result-actions { display: flex; gap: 18px; align-items: center; }
.text-button { color: var(--purple-deep); background: none; border: 0; cursor: pointer; border-bottom: 1px solid rgba(128,99,181,.35); padding: 5px 0; }
.save-status { min-height: 18px; margin: -15px 0 7px; text-align: right; color: var(--purple-deep); font-size: 11px; }
.stage-shell { position: relative; overflow: hidden; min-height: 410px; display: grid; align-items: center; padding: 36px 30px; border: 1px solid rgba(128,99,181,.11); border-radius: 24px; background: rgba(255,255,255,.55); }
.stage-glow { position: absolute; width: 540px; height: 340px; left: 50%; top: 48%; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(216,201,239,.68), rgba(244,237,251,.32) 50%, transparent 72%); filter: blur(4px); }
.cards-stage { position: relative; z-index: 1; display: grid; justify-content: center; gap: 22px; }
.cards-stage.dragging { cursor: grabbing !important; scroll-snap-type: none !important; user-select: none; }
.stage-nav { display: none; position: absolute; z-index: 4; top: 50%; width: 38px; height: 38px; min-height: 0; padding: 0; place-items: center; border: 1px solid rgba(128,99,181,.2); border-radius: 50%; background: rgba(255,255,255,.9); color: var(--purple-deep); box-shadow: 0 5px 18px rgba(72,52,105,.13); cursor: pointer; font: 25px/1 var(--sans); }
.stage-shell.has-overflow .stage-nav { display: grid; }
.stage-prev { left: 10px; }
.stage-next { right: 10px; }
.stage-nav:disabled { opacity: .28; cursor: default; }
.cards-1 { grid-template-columns: minmax(190px, 245px); }
.cards-3 { grid-template-columns: repeat(3, minmax(145px, 205px)); }
.cards-many { grid-template-columns: repeat(5, minmax(105px, 145px)); gap: 20px 16px; }
.reading-card { min-width: 0; text-align: center; opacity: .92; transition: opacity .2s, transform .2s; }
.reading-card.selected { opacity: 1; transform: translateY(-4px); }
.position-label { overflow: hidden; margin: 0 0 9px; min-height: 20px; color: var(--purple-deep); font: 500 12px var(--serif); text-overflow: ellipsis; white-space: nowrap; }
.card-flip { display: block; width: 100%; aspect-ratio: 7 / 12; margin: 0 auto; padding: 0; background: none; border: 0; perspective: 1200px; cursor: pointer; }
.card-inner { display: block; position: relative; width: 100%; height: 100%; transition: transform .72s cubic-bezier(.2,.75,.25,1); transform-style: preserve-3d; }
.card-flip.revealed .card-inner { transform: rotateY(180deg); }
.card-back, .card-front { position: absolute; inset: 0; overflow: hidden; border-radius: 10px; backface-visibility: hidden; box-shadow: 0 16px 34px rgba(61,43,91,.17); border: 4px solid #e2d7b8; }
.card-back { display: grid; place-items: center; background-color: #6f58a0; background-image: repeating-linear-gradient(45deg, transparent 0 12px, rgba(255,255,255,.12) 12px 13px), repeating-linear-gradient(-45deg, transparent 0 12px, rgba(255,255,255,.09) 12px 13px); }
.card-back::before { content: ""; position: absolute; inset: 10%; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; }
.card-back span { color: #fff8db; font-size: 42px; z-index: 1; }
.card-back i { width: 62%; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.25); position: absolute; transform: rotate(45deg); }
.card-front { transform: rotateY(180deg); background: #e7dcbf; }
.card-front img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-front img.reversed { transform: rotate(180deg); }
.card-detail { display: grid; grid-template-columns: 155px minmax(0, 1fr); gap: 34px; margin-top: 14px; padding: 29px 32px 32px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgba(72,52,105,.06); animation: fade-in .3s ease; }
.detail-position { padding-right: 24px; border-right: 1px solid var(--line); color: var(--purple-deep); font: 550 15px/1.6 var(--serif); }
.detail-position span { display: block; margin-bottom: 8px; color: var(--muted); font: 700 9px var(--sans); letter-spacing: .16em; }
.detail-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.detail-copy h3 { margin: 5px 0 0; font-size: 27px; }
.detail-copy h3 small { margin-left: 10px; color: var(--muted); font: 11px var(--sans); }
.orientation-badge { flex: 0 0 auto; padding: 5px 10px; border: 1px solid rgba(128,99,181,.22); border-radius: 999px; background: var(--lavender-soft); color: var(--purple-deep); font-size: 11px; }
.orientation-badge.is-reversed { border-color: rgba(182,149,85,.25); background: #f8f1e4; color: #8a6c35; }
.detail-section { padding-top: 19px; }
.detail-section + .detail-section { margin-top: 19px; border-top: 1px solid var(--line); }
.detail-section h4 { display: flex; align-items: center; gap: 10px; margin: 0 0 11px; color: var(--ink); font: 600 14px var(--serif); }
.detail-section h4 span { color: var(--purple); font: 700 9px var(--sans); letter-spacing: .08em; }
.detail-section p { max-width: 720px; margin: 0; color: #5e5669; font-size: 14px; line-height: 1.9; }
.keyword-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.keyword-list li { padding: 5px 10px; border-radius: 999px; background: var(--lavender-soft); color: var(--purple-deep); font-size: 12px; }
.card-meta { margin: 0; color: var(--gold); font-size: 10px; letter-spacing: .08em; }

.page-heading { padding: 70px 0 35px; max-width: 760px; }
.page-heading h1 { font-size: clamp(38px, 6vw, 58px); margin: 10px 0; }
.page-heading > p:last-child { color: var(--muted); }
.history-list { max-width: 820px; padding-bottom: 70px; }
.history-entry { margin-bottom: 12px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.65); position: relative; }
.history-entry h2 { margin: 8px 80px 10px 0; font-size: 21px; }
.history-entry > p { color: #625a6c; line-height: 1.7; white-space: pre-wrap; }
.history-date, .history-cards { color: var(--purple) !important; font-size: 11px; letter-spacing: .04em; }
.delete-button { position: absolute; right: 20px; top: 20px; color: var(--muted); background: none; border: 0; cursor: pointer; }
.delete-button:hover { color: #b65461; }
.empty-state { padding: 65px 20px; text-align: center; background: rgba(255,255,255,.58); border: 1px dashed rgba(128,99,181,.28); border-radius: 18px; }
.empty-state span { color: var(--purple); font-size: 36px; }
.empty-state p { color: var(--muted); }
.prose { max-width: 760px; padding: 30px 34px 70px; margin-bottom: 70px; background: rgba(255,255,255,.58); border: 1px solid var(--line); border-radius: 18px; font: 16px/2 var(--serif); color: #5d5568; }
.prose h2 { color: var(--ink); margin-top: 38px; }
footer { width: min(1120px, calc(100% - 40px)); margin: 45px auto 0; padding: 24px 0 34px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; display: flex; justify-content: space-between; }

@media (max-width: 760px) {
  body { padding-bottom: 76px; }
  .ambient { width: 300px; height: 300px; }
  .site-header { width: calc(100% - 28px); padding: 14px 0; }
  .brand small { display: none; }
  .brand-mark { width: 32px; height: 32px; }
  .brand strong { font-size: 14px; }
  .site-header nav { position: fixed; z-index: 40; left: 14px; right: 14px; bottom: 12px; justify-content: space-around; padding: 6px; background: rgba(255,255,255,.92); border: 1px solid rgba(128,99,181,.14); box-shadow: 0 10px 35px rgba(61,43,91,.16); backdrop-filter: blur(16px); }
  .nav-link { flex: 1; padding: 8px; }
  main { width: calc(100% - 28px); }
  .hero { display: block; padding: 35px 0 23px; }
  .hero h1 { font-size: clamp(34px, 10.5vw, 45px); margin: 11px 0 12px; }
  .lead { font-size: 13px; line-height: 1.7; }
  .daily-note { display: none; }
  .reading-panel { border-radius: 17px; }
  .form-section { grid-template-columns: 30px minmax(0, 1fr); gap: 8px; padding: 20px 16px; }
  .section-hint { margin-bottom: 13px; }
  .spread-options { display: flex; overflow-x: auto; gap: 9px; margin-right: -16px; padding: 1px 16px 8px 0; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .spread-options::-webkit-scrollbar { display: none; }
  .spread-option { flex: 0 0 145px; scroll-snap-align: start; }
  .spread-option span { min-height: 94px; }
  .advanced-spreads { margin-top: 10px; }
  .more-spreads summary span { display: none; }
  .reading-actions { display: block; padding: 15px 16px 17px; }
  .toggle-row { margin-bottom: 14px; }
  .primary-button { width: 100%; min-width: 0; padding: 15px 18px; }
  .reading-result { padding-top: 55px; }
  .result-heading { align-items: end; gap: 16px; margin-bottom: 18px; }
  .result-heading h2 { font-size: 28px; }
  .result-tip { max-width: 230px; line-height: 1.5; }
  .result-actions { flex: 0 0 auto; flex-direction: column; gap: 1px; align-items: flex-end; }
  .text-button { flex: 0 0 auto; min-height: 33px; font-size: 12px; }
  .save-status { margin-top: -10px; }
  .stage-shell { min-height: 390px; margin: 0 -14px; padding: 28px 14px; border-radius: 0; border-left: 0; border-right: 0; }
  .cards-stage { width: 100%; }
  .cards-1 { grid-template-columns: minmax(190px, 235px); }
  .cards-3, .cards-many { display: flex; justify-content: flex-start; overflow-x: auto; gap: 14px; padding: 6px calc((100vw - 180px) / 2) 20px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .cards-3, .cards-many { cursor: grab; }
  .cards-3::-webkit-scrollbar, .cards-many::-webkit-scrollbar { display: none; }
  .cards-3 .reading-card, .cards-many .reading-card { flex: 0 0 166px; scroll-snap-align: center; }
  .position-label { white-space: normal; height: 34px; line-height: 1.35; }
  .card-back, .card-front { border-width: 3px; }
  .card-detail { display: block; margin-top: 10px; padding: 20px; }
  .detail-position { padding: 0 0 10px; margin-bottom: 12px; border: 0; border-bottom: 1px solid var(--line); }
  .detail-position span { display: inline; margin-right: 8px; }
  .detail-copy h3 { font-size: 23px; }
  .detail-copy h3 small { display: block; margin: 5px 0 0; }
  .detail-title { align-items: flex-start; }
  .detail-section p { font-size: 13px; line-height: 1.85; }
  .page-heading { padding-top: 44px; }
  .history-entry { padding: 20px; }
  .prose { padding: 22px 20px 50px; }
  footer { width: calc(100% - 28px); margin-top: 25px; flex-direction: column; gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
