/* しるべ占い あお：セルフ鑑定アプリの見た目と演出
   動きを減らす設定の人には、app.js が <html> に .rm を付け、動きを止める。 */

:root {
  --night-1: #0b1030;
  --night-2: #1a1f5c;
  --night-3: #2e1d52;
  --ink: #eef0fb;
  --muted: #b8bedb;
  --faint: #8a90b4;
  --gold: #e6c47c;
  --gold-hi: #f7e2a8;
  --gold-line: rgba(230, 196, 124, 0.55);
  --move: #f0cd7e;      /* 動く：金 */
  --prep: #a6d8f2;      /* 準備する：水色 */
  --tidy: #f2e8d2;      /* 整える：生成り色 */
  --panel: rgba(16, 20, 60, 0.62);
  --panel-line: rgba(230, 196, 124, 0.28);
  --serif: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", "YuMincho", "Noto Serif JP", "Noto Serif CJK JP", "Source Han Serif JP", serif;
  --sans: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.rm { scroll-behavior: auto; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--night-1);
  background-image: linear-gradient(175deg, var(--night-1) 0%, var(--night-2) 52%, var(--night-3) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
  overflow-x: hidden;
}

a { color: var(--gold-hi); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: 0.04em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }

/* ---------- 夜空 ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.stars { position: absolute; top: 0; left: 0; width: 2px; height: 2px; border-radius: 50%; background: transparent; }
#stars-a { animation: twinkle 5s ease-in-out infinite; }
#stars-b { animation: twinkle 7s ease-in-out -2s infinite; }
#stars-c { animation: twinkle 9s ease-in-out -4s infinite; width: 3px; height: 3px; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.moon {
  position: absolute; top: 34px; right: 26px; width: 46px; height: 46px; border-radius: 50%;
  box-shadow: inset -11px 5px 0 0 var(--gold-hi);
  filter: drop-shadow(0 0 10px rgba(247, 226, 168, 0.55));
  transform: rotate(-18deg);
}

/* ---------- 全体の枠 ---------- */
main { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; padding: 18px 16px 40px; }
.brand { margin: 0 0 6px; font-size: 12px; color: var(--muted); letter-spacing: 0.08em; padding-right: 60px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 16px;
  padding: 20px 18px;
  margin: 18px 0;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.panel h2 { margin: 0 0 12px; font-size: 20px; color: var(--gold-hi); text-align: center; }
.panel h3 { margin: 16px 0 4px; font-size: 15px; color: var(--gold); }
.note { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin: 10px 0 0; }
.center { text-align: center; }

/* ---------- ボタン ---------- */
.btn {
  display: block; width: 100%; margin: 14px 0 0; padding: 15px 16px;
  border-radius: 999px; border: 1px solid var(--gold-line);
  font: 600 16px/1.4 var(--serif); letter-spacing: 0.06em; text-align: center; text-decoration: none;
  color: var(--ink); background: transparent; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-gold {
  color: #1d1636; border-color: transparent;
  background: linear-gradient(135deg, #f8e6b0 0%, #e2bd6d 55%, #c99b4a 100%);
  box-shadow: 0 0 18px rgba(230, 196, 124, 0.35);
}
.btn-line { background: rgba(255, 255, 255, 0.06); }
.btn-ghost { background: rgba(255, 255, 255, 0.03); color: var(--muted); font-size: 14.5px; }
.btn.small { display: inline-block; width: auto; padding: 9px 20px; font-size: 14px; }
.btn:focus-visible, select:focus-visible, .flip:focus-visible, summary:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
.btn:active { transform: translateY(1px); }

/* ---------- 場面0：9枚のカードの輪 ---------- */
.hero { text-align: center; padding-top: 6px; }
.ring-wrap { position: relative; width: 272px; height: 272px; margin: 6px auto 4px; }
.ring { position: absolute; inset: 0; animation: spin 70s linear infinite; }
.ring-glow {
  position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  background: radial-gradient(circle, rgba(247, 226, 168, 0.35) 0%, rgba(247, 226, 168, 0) 70%);
  animation: breathe 6s ease-in-out infinite;
}
.rcard {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 62px; margin: -31px 0 0 -22px;
}
.rcard-inner {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  border-radius: 7px; border: 1px solid var(--gold-line);
  background: linear-gradient(160deg, rgba(40, 44, 110, 0.95), rgba(26, 20, 64, 0.95));
  font: 600 24px/1 var(--serif); color: var(--gold-hi);
  box-shadow: 0 0 12px rgba(150, 160, 255, 0.18);
  animation: spin 70s linear infinite reverse;
}
.rcard.k-move .rcard-inner { color: var(--move); }
.rcard.k-prep .rcard-inner { color: var(--prep); }
.rcard.k-tidy .rcard-inner { color: var(--tidy); }
.rcard:nth-child(1) { transform: rotate(0deg) translateY(-112px) rotate(0deg); }
.rcard:nth-child(2) { transform: rotate(40deg) translateY(-112px) rotate(-40deg); }
.rcard:nth-child(3) { transform: rotate(80deg) translateY(-112px) rotate(-80deg); }
.rcard:nth-child(4) { transform: rotate(120deg) translateY(-112px) rotate(-120deg); }
.rcard:nth-child(5) { transform: rotate(160deg) translateY(-112px) rotate(-160deg); }
.rcard:nth-child(6) { transform: rotate(200deg) translateY(-112px) rotate(-200deg); }
.rcard:nth-child(7) { transform: rotate(240deg) translateY(-112px) rotate(-240deg); }
.rcard:nth-child(8) { transform: rotate(280deg) translateY(-112px) rotate(-280deg); }
.rcard:nth-child(9) { transform: rotate(320deg) translateY(-112px) rotate(-320deg); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: 0.6; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.12); } }

.title { margin: 8px 0 8px; font-size: 25px; line-height: 1.5; color: var(--gold-hi); text-shadow: 0 0 18px rgba(247, 226, 168, 0.35); }
.lead { margin: 0 4px; font-size: 14.5px; color: var(--ink); }

/* ---------- 場面1：入力 ---------- */
.selects { display: flex; gap: 12px; }
.sel { flex: 1; display: block; }
.sel-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.sel-box { display: flex; align-items: center; gap: 6px; font-family: var(--serif); font-size: 16px; }
.sel select {
  flex: 1; min-width: 0; appearance: none; -webkit-appearance: none;
  padding: 12px 30px 12px 14px; border-radius: 10px;
  border: 1px solid var(--gold-line); color: var(--ink); font: 600 18px/1.2 var(--serif);
  background: rgba(8, 10, 36, 0.7) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23e6c47c' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center;
}
.error { color: #ffcf9c; font-size: 13.5px; margin: 10px 0 0; }

/* ---------- 場面2：計算の儀式 ---------- */
.ritual {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 45%, #2e246e 0%, #080a22 70%);
  animation: fade-in 0.35s ease-out both;
}
.ritual-inner { width: 100%; max-width: 420px; padding: 0 20px; text-align: center; }
.ritual-caption { font-family: var(--serif); color: var(--muted); letter-spacing: 0.1em; margin: 0 0 22px; }
.ritual-digits { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 3px; min-height: 52px; }
.rd {
  display: inline-block; font: 600 26px/1.4 var(--serif); color: var(--gold-hi);
  text-shadow: 0 0 12px rgba(247, 226, 168, 0.9), 0 0 26px rgba(247, 226, 168, 0.45);
  opacity: 0; animation: rise 0.6s ease-out forwards;
}
.rd.op { color: var(--muted); font-size: 15px; text-shadow: none; }
.ritual-lines { min-height: 64px; margin-top: 10px; }
.rl { font: 600 18px/1.8 var(--serif); color: var(--ink); opacity: 0; animation: fade-in 0.5s ease-out forwards; }
.ritual-number {
  font: 600 110px/1.1 var(--serif); color: var(--gold-hi); min-height: 124px; margin-top: 6px;
  text-shadow: 0 0 24px rgba(247, 226, 168, 0.9), 0 0 60px rgba(230, 196, 124, 0.6);
}
.ritual-number.show { animation: bloom 0.9s ease-out both; }
.skip { width: auto; display: inline-block; margin-top: 26px; padding: 9px 26px; }
@keyframes rise { 0% { opacity: 0; transform: translateY(16px) scale(0.6); filter: blur(4px); } 60% { opacity: 1; filter: blur(0); } 100% { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes bloom { 0% { opacity: 0; transform: scale(0.4); filter: blur(8px); } 70% { opacity: 1; transform: scale(1.08); filter: blur(0); } 100% { transform: scale(1); } }

/* ---------- めくるカード（共通） ---------- */
.flip { perspective: 1100px; background: none; border: 0; padding: 0; color: inherit; font: inherit; display: block; -webkit-tap-highlight-color: transparent; }
.flip-inner {
  position: relative; display: block; width: 100%; height: 100%;
  transform-style: preserve-3d; -webkit-transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 12px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.face.back {
  border: 1px solid var(--gold-line);
  background: radial-gradient(circle at 50% 40%, #2e3290 0%, #1b1a56 55%, #140f3c 100%);
  color: var(--gold);
}
.face.back::after { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(230, 196, 124, 0.3); border-radius: 8px; }
.face.front { transform: rotateY(180deg); border: 1px solid var(--gold-line); background: linear-gradient(170deg, #20246a 0%, #191650 60%, #2a1a52 100%); }
.pattern { width: 72%; height: 72%; color: var(--gold); }

/* ---------- 場面3：大きなカード ---------- */
.s3 { text-align: center; padding-top: 6px; }
.big-card-wrap { width: 248px; height: 348px; margin: 6px auto 0; }
.big-card { width: 100%; height: 100%; }
.big-card.enter { animation: come-forward 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.big-card .face { border-radius: 16px; }
.big-card .face.front { border-color: rgba(247, 226, 168, 0.75); box-shadow: inset 0 0 30px rgba(247, 226, 168, 0.12); }
.big-card.flipped .face.front { animation: glow 2.4s ease-out 0.5s both; }
.bc-label { margin: 0; font: 600 14px/1.4 var(--serif); color: var(--muted); letter-spacing: 0.1em; }
.bc-number-wrap { position: relative; width: 190px; height: 190px; display: flex; align-items: center; justify-content: center; }
.bc-stars { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--gold-hi); }
.bc-number { margin: 0; font: 600 96px/1 var(--serif); color: var(--gold-hi); text-shadow: 0 0 20px rgba(247, 226, 168, 0.7); }
.bc-kubun { margin: 0; padding: 3px 18px; border-radius: 999px; font: 600 16px/1.5 var(--serif); color: #1d1636; }
.bc-theme { margin: 8px 0 0; font: 600 17px/1.4 var(--serif); color: var(--ink); }
.k-bg-move { background: var(--move); }
.k-bg-prep { background: var(--prep); }
.k-bg-tidy { background: var(--tidy); }
.calc-line { margin: 14px 0 0; font: 600 15px/1.7 var(--serif); color: var(--gold-hi); word-break: keep-all; overflow-wrap: anywhere; }
@keyframes come-forward { 0% { opacity: 0; transform: translateY(40px) scale(0.55); } 100% { opacity: 1; transform: none; } }
@keyframes glow { 0% { box-shadow: 0 0 0 rgba(247, 226, 168, 0); } 30% { box-shadow: 0 0 46px rgba(247, 226, 168, 0.75); } 100% { box-shadow: 0 0 18px rgba(247, 226, 168, 0.3); } }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- 場面4 ---------- */
.flow, .fit { margin: 0; font-size: 15px; }

/* ---------- 場面5：12ヶ月のカード ---------- */
.count { margin: 0; text-align: center; font: 600 18px/1.6 var(--serif); color: var(--gold-hi); }
.count-note { margin: 4px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.moves-note { margin: 10px 0 0; font-size: 14.5px; }
.prompt { margin: 14px 0 0; text-align: center; font-family: var(--serif); font-weight: 600; }
.left { margin: 0 0 10px; text-align: center; font-size: 13px; color: var(--gold); min-height: 1.8em; }
.months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mcard { width: 100%; aspect-ratio: 3 / 4; cursor: pointer; }
.mcard .face { border-radius: 10px; padding: 6px 4px; }
.mcard .m-label { position: relative; z-index: 1; margin-top: 4px; font: 600 15px/1.2 var(--serif); color: var(--ink); }
.mcard .back .pattern { position: absolute; width: 70%; height: 70%; opacity: 0.75; }
.mcard .front { gap: 1px; text-align: center; padding-top: 18px; }
.mf-month { position: absolute; top: 5px; left: 7px; font: 600 12.5px/1.2 var(--serif); color: var(--muted); }
.mf-pm-label { font-size: 9.5px; color: var(--faint); line-height: 1.2; margin-top: 2px; }
.mf-pm { font: 600 30px/1.05 var(--serif); }
.mf-kubun { font: 600 12px/1.25 var(--serif); }
.mf-word { font-size: 10.5px; line-height: 1.3; color: var(--ink); }
.mf-line { font-size: 9.5px; line-height: 1.3; color: var(--faint); margin-top: 2px; }
.mf-badge { position: absolute; top: 5px; right: 5px; font-size: 8.5px; line-height: 1; padding: 3px 4px; border-radius: 999px; background: var(--move); color: #1d1636; font-weight: 700; }
.mcard.k-move .mf-pm, .mcard.k-move .mf-kubun { color: var(--move); }
.mcard.k-prep .mf-pm, .mcard.k-prep .mf-kubun { color: var(--prep); }
.mcard.k-tidy .mf-pm, .mcard.k-tidy .mf-kubun { color: var(--tidy); }
.mcard.flipped.k-move .face.front { border-color: var(--move); animation: gold-glow 2.2s ease-out 0.6s both; }
.mcard.locked { cursor: default; }
.mcard.locked .face.back { filter: saturate(0.4) brightness(0.62); }
.mcard .lock { position: absolute; z-index: 2; top: 9px; right: 9px; width: 18px; height: 18px; color: var(--gold-hi); opacity: 0; transition: opacity 0.5s; }
.mcard.locked .lock { opacity: 0.95; }
.locked-msg { margin-top: 14px; text-align: center; }
.locked-msg p { margin: 0; font-size: 14.5px; }
@keyframes gold-glow { 0% { box-shadow: 0 0 0 rgba(240, 205, 126, 0); } 35% { box-shadow: 0 0 26px rgba(240, 205, 126, 0.95); } 100% { box-shadow: 0 0 12px rgba(240, 205, 126, 0.45); } }

/* ---------- 場面6：今月 ---------- */
.month-now { border-radius: 12px; padding: 14px 14px; border: 1px solid var(--gold-line); background: rgba(255, 255, 255, 0.03); }
.month-now.k-move { border-color: var(--move); }
.month-now.k-prep { border-color: var(--prep); }
.month-now.k-tidy { border-color: var(--tidy); }
.mn-line { margin: 0; font: 600 15px/1.7 var(--serif); }
.mn-fit { margin: 8px 0 0; font-size: 14.5px; color: var(--ink); }

/* ---------- 場面7：今日のカード ---------- */
.daily-wrap { display: flex; justify-content: center; }
.daily-card { width: 220px; height: 300px; cursor: pointer; }
.daily-card .face { padding: 18px; }
.daily-card .back .pattern { position: absolute; width: 74%; height: 74%; opacity: 0.6; }
.daily-cta { position: relative; z-index: 1; font: 600 15px/1.5 var(--serif); color: var(--gold-hi); background: rgba(10, 10, 40, 0.75); padding: 6px 14px; border-radius: 999px; border: 1px solid var(--gold-line); }
.daily-card .front { justify-content: center; text-align: left; }
.daily-card.k-move .front { border-color: var(--move); }
.daily-card.k-prep .front { border-color: var(--prep); }
.daily-card.k-tidy .front { border-color: var(--tidy); }
.dc-title { font: 600 24px/1.4 var(--serif); color: var(--gold-hi); margin-bottom: 12px; text-align: center; width: 100%; }
.daily-card.k-prep .dc-title { color: var(--prep); }
.daily-card.k-tidy .dc-title { color: var(--tidy); }
.dc-text { font-size: 14.5px; line-height: 1.8; color: var(--ink); }
.daily-card.flipped { cursor: default; }
.after { text-align: center; font-size: 13px; color: var(--muted); margin: 12px 0 0; }

/* ---------- 場面8：カード画像 ---------- */
.share-img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--gold-line); -webkit-touch-callout: default; }
.btns .btn:first-child { margin-top: 12px; }

/* ---------- 場面9 ---------- */
.note-title { margin: 0; text-align: center; font: 600 16px/1.6 var(--serif); color: var(--ink); }
.points { margin: 12px 0 0; padding: 0 0 0 1.2em; font-size: 14.5px; }
.points li { margin: 4px 0; }
.points li::marker { content: "✦ "; color: var(--gold); }
.line-block { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--panel-line); }
#note-block[hidden] + .line-block { margin-top: 0; padding-top: 0; border-top: 0; }
.line-lead { margin: 0; text-align: center; font-size: 13.5px; color: var(--muted); }
.again-wrap { margin: 8px 0 0; }

/* ---------- 出し方・下の文 ---------- */
.howto summary { cursor: pointer; font: 600 16px/1.5 var(--serif); color: var(--gold-hi); list-style: none; text-align: center; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: " ▾"; color: var(--gold); }
.howto[open] summary::after { content: " ▴"; }
.howto ul { margin: 12px 0 0; padding-left: 1.1em; font-size: 14px; }
.howto li { margin: 6px 0; }
.foot { margin-top: 26px; font-size: 11.5px; line-height: 1.75; color: var(--faint); }
.foot p { margin: 0 0 8px; }
.foot a { color: var(--muted); }
.owner { margin-top: 14px !important; text-align: center; color: var(--muted); }
.noscript { position: relative; z-index: 2; max-width: 480px; margin: 20px auto; padding: 0 16px; color: var(--ink); }

/* ---------- プライバシーポリシーのページ ---------- */
.doc .brand { padding-right: 0; }
.doc h1 { font-size: 22px; color: var(--gold-hi); margin: 10px 0 14px; text-align: center; }
.doc h2 { font-size: 16px; text-align: left; margin: 22px 0 6px; }
.doc p, .doc li { font-size: 14.5px; }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc .back-link { display: block; text-align: center; margin-top: 24px; }

/* ---------- 動きを減らす ---------- */
html.rm *, html.rm *::before, html.rm *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  animation-delay: 0s !important;
  transition-duration: 0.001ms !important;
  transition-delay: 0s !important;
}
html.rm #stars-a, html.rm #stars-b, html.rm #stars-c, html.rm .ring, html.rm .rcard-inner, html.rm .ring-glow { animation: none !important; }

@media (min-width: 420px) {
  .title { font-size: 27px; }
}
