/* なりたさんどっち — 藍（あい）と 金（きん）の 和ふう スタイル */

:root {
  --ai-950: #090d24;
  --ai-900: #0e1431;
  --ai-800: #141c42;
  --ai-700: #1c2756;
  --ai-600: #29366c;
  --kin-50: #fff8e3;
  --kin-200: #f5e0a3;
  --kin-400: #e3bf68;
  --kin-500: #d2a548;
  --kin-700: #9b7128;
  --shu: #cf4a2e;
  --shu-deep: #a3331b;
  --washi: #f6efdd;
  --text: #f1e9d2;
  --muted: #b5ad97;
  --gold: linear-gradient(135deg, #fff3c9 0%, #ecc870 28%, #c99330 52%, #f3d98a 74%, #ad7c26 100%);
  --font-maru: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-mincho: "Zen Old Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--font-maru);
  font-weight: 500;
  line-height: 1.7;
  background-color: var(--ai-900);
  background-image:
    var(--tile-backdrop, none),
    radial-gradient(130% 70% at 50% 0%, #27346e 0%, #141c42 48%, #0a0f28 100%);
  background-size: 240px 240px, 100% 100%;
  background-attachment: scroll, fixed;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

html.lock,
html.lock body { overflow: hidden; }

/* わかちがきの ことばの とちゅうで かいぎょう しない */
.app, .modal, .camera, .blessing, .toast { word-break: keep-all; overflow-wrap: anywhere; }
.doc { word-break: normal; overflow-wrap: normal; }

a { color: var(--kin-200); }

.gold { color: var(--kin-400); }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-t) + 14px) 16px 0;
}

/* ---------- 見出し ---------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 4px;
  text-align: center;
}

.hero-kumo { width: 100%; max-width: 120px; height: auto; overflow: visible; }
.hero-kumo--l { justify-self: end; transform: translateY(8px); animation: float-l 7s ease-in-out infinite; }
.hero-kumo--r { justify-self: start; transform: scaleX(-1) translateY(-6px); animation: float-r 8s ease-in-out infinite; }

@keyframes float-l { 50% { transform: translate(-6px, 4px); } }
@keyframes float-r { 50% { transform: scaleX(-1) translate(-6px, -10px); } }

.logo {
  margin: 0;
  font-family: var(--font-mincho);
  font-weight: 900;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.logo span {
  background: var(--gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35));
}

.logo-sm { font-size: clamp(22px, 6.4vw, 28px); letter-spacing: .14em; padding-left: .14em; }
.logo-lg { font-size: clamp(46px, 14vw, 62px); letter-spacing: .08em; padding-left: .08em; }

/* ---------- コンパス ---------- */

.main { flex: 1; display: flex; flex-direction: column; align-items: center; }

.dial {
  position: relative;
  width: min(80vw, 330px, 40vh);
  width: min(80vw, 330px, 40dvh);
  min-width: 240px;
  aspect-ratio: 1;
  margin: 6px auto 0;
}

.dial svg { display: block; width: 100%; height: 100%; overflow: visible; }

.dial .eto { font-family: var(--font-mincho); font-weight: 700; font-size: 19px; fill: var(--kin-200); }
.dial .card {
  font-family: var(--font-maru);
  font-weight: 900;
  font-size: 21px;
  fill: var(--washi);
  stroke: #111840;
  stroke-width: 6px;
  stroke-linejoin: round;
  paint-order: stroke;
}
.dial .card.north { fill: #ff8a6b; }
.dial .medal-text { font-family: var(--font-mincho); font-weight: 900; font-size: 25px; fill: var(--ai-900); }

.dial .lubber { transition: opacity .3s; }
.dial .medal { transition: filter .3s; }
.dial.no-compass .lubber { opacity: 0; }
.dial.aligned .medal { filter: url(#dialGlow); }
.dial.aligned .lubber { animation: lubber-pulse 1s ease-in-out infinite; }
.dial.waiting .needle,
.dial.waiting .medal { opacity: 0; }

@keyframes lubber-pulse { 50% { opacity: .55; } }

.dial::after {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 0 rgba(255, 220, 130, 0);
  transition: box-shadow .4s;
}
.dial.aligned::after { box-shadow: 0 0 34px 6px rgba(255, 214, 120, .35); }

/* ---------- よみとり ---------- */

.reading { text-align: center; margin-top: 2px; }
.reading p { margin: 0; }
.reading-label { font-size: 15px; color: var(--muted); letter-spacing: .1em; }

.reading-dir { display: flex; align-items: baseline; justify-content: center; gap: 6px; }

.dir-kana {
  font-family: var(--font-mincho);
  font-weight: 900;
  font-size: clamp(40px, 12vw, 52px);
  line-height: 1.15;
  letter-spacing: .08em;
  background: var(--gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.dir-no { font-size: 18px; font-weight: 700; color: var(--text); }
.dir-help { font-size: 13px; color: var(--muted); min-height: 0; }
.dir-help:empty { display: none; }
.dir-sub { font-size: 15px; color: var(--kin-200); letter-spacing: .04em; }

/* 「はじめる」を おす まえは、ほうがくの もじは ださない */
.pre-start .reading,
.pre-start .hint { display: none; }

.hint {
  min-height: 1.7em;
  margin: 6px 0 2px;
  padding: 0 8px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--washi);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hint.good { color: var(--kin-200); text-shadow: 0 0 16px rgba(255, 210, 110, .55); }

/* ---------- ボタン ---------- */

.actions {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-top: 6px;
}

.btn {
  position: relative;
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  letter-spacing: .08em;
  border-radius: 999px;
  min-height: 56px;
  padding: 12px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .12s ease, filter .2s;
  touch-action: manipulation;
}

.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid var(--kin-200); outline-offset: 3px; }

.btn-gold {
  color: var(--ai-900);
  font-size: 19px;
  background: var(--gold);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .7),
    inset 0 -2px 0 rgba(120, 80, 20, .35),
    0 6px 18px rgba(0, 0, 0, .35),
    0 0 0 1px rgba(255, 230, 160, .4);
  overflow: hidden;
}

.btn-gold::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .55) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: shine 3.6s ease-in-out infinite;
}

@keyframes shine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }

.btn-ghost {
  color: var(--kin-200);
  font-size: 16px;
  background: rgba(14, 20, 49, .55);
  box-shadow: inset 0 0 0 1.5px rgba(227, 191, 104, .6);
}

.btn-small { min-height: 42px; font-size: 14px; align-self: center; padding: 8px 18px; }

.btn-icon { width: 24px; height: 24px; flex: none; }

#cameraBtn { white-space: nowrap; font-size: clamp(16px, 4.6vw, 19px); letter-spacing: .04em; padding-left: 16px; padding-right: 16px; }

/* ---------- コンパスが つかえない とき ---------- */

.notice {
  padding: 14px 16px 16px;
  border-radius: 14px;
  text-align: center;
  background: rgba(14, 20, 49, .7);
  box-shadow: inset 0 0 0 1.5px rgba(227, 191, 104, .5);
}
.notice-text { margin: 0; font-size: 15px; font-weight: 700; color: var(--washi); }

.qr { margin-top: 12px; }
.qr-code {
  width: 148px;
  height: 148px;
  margin: 0 auto;
  padding: 8px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 0 0 2px var(--kin-500), 0 0 0 6px rgba(14, 20, 49, .9), 0 0 0 7px rgba(227, 191, 104, .5);
}
.qr-code svg { display: block; width: 100%; height: 100%; }
.qr-caption { margin: 10px 0 0; font-size: 13px; color: var(--kin-200); }

/* ---------- おしらせ（アラート） ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 20px) 20px calc(var(--safe-b) + 20px);
  background: rgba(5, 8, 26, .72);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: modal-bg .2s ease-out;
}

.modal-card {
  width: 100%;
  max-width: 360px;
  max-height: 100%;
  overflow-y: auto;
  padding: 22px 20px 18px;
  border-radius: 18px;
  text-align: center;
  background: linear-gradient(180deg, #1f2a5c, #121a40);
  box-shadow: 0 0 0 1.5px rgba(240, 210, 130, .9), 0 0 0 7px rgba(14, 20, 49, .95), 0 0 0 8px rgba(227, 191, 104, .5), 0 20px 50px rgba(0, 0, 0, .6);
  animation: modal-in .28s cubic-bezier(.2, .9, .3, 1.2);
}

.modal-title {
  margin: 0 0 10px;
  font-family: var(--font-mincho);
  font-weight: 900;
  font-size: 21px;
  letter-spacing: .06em;
  color: var(--kin-200);
}
.modal-title::before { content: "⚠ "; color: #ff9a7a; }
.modal-body { margin: 0 0 10px; font-size: 16px; font-weight: 700; color: var(--washi); }
.modal-note {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  background: rgba(9, 13, 36, .55);
}
.modal-note:empty { display: none; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }
.modal-actions .btn { min-height: 50px; }

@keyframes modal-bg { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }

/* ---------- つかいかた ---------- */

.howto {
  width: 100%;
  margin: 22px 0 8px;
  border-radius: 14px;
  background: rgba(14, 20, 49, .6);
  box-shadow: inset 0 0 0 1px rgba(227, 191, 104, .28);
}

.howto summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  font-weight: 700;
  color: var(--kin-200);
  text-align: center;
  letter-spacing: .1em;
}
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: " ＋"; color: var(--kin-400); }
.howto[open] summary::after { content: " －"; }

.howto ol { margin: 0; padding: 0 18px 0 38px; font-size: 15px; }
.howto li { margin-bottom: 6px; }
.howto-note { margin: 8px 16px 14px; font-size: 12px; line-height: 1.7; color: var(--muted); }

/* ---------- フッター ---------- */

.footer {
  margin: 20px -16px 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.more-apps {
  margin: 0 16px 22px;
  padding: 16px 14px 14px;
  border-radius: 14px;
  background: rgba(14, 20, 49, .6);
  box-shadow: inset 0 0 0 1px rgba(227, 191, 104, .28);
}
.more-apps-title {
  margin: 0 0 10px;
  font-family: var(--font-mincho);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .1em;
  color: var(--kin-200);
}
.more-apps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.more-apps-list a {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px 10px 9px;
  border-radius: 10px;
  text-align: left;
  text-decoration: none;
  background: rgba(246, 239, 221, .06);
  box-shadow: inset 0 0 0 1px rgba(227, 191, 104, .22);
  transition: background .2s;
}
.more-apps-list a:hover { background: rgba(246, 239, 221, .12); }
.more-apps-list b { font-size: 14px; color: var(--washi); }
.more-apps-list span { font-size: 11px; line-height: 1.5; color: var(--muted); }
.more-apps-all {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}
.footer-studio { margin: 0 0 6px; }

.disclaimer { margin: 0 20px 6px; }
.footer-nav { margin-bottom: 12px; }
.footer-nav a { font-size: 13px; letter-spacing: .08em; }

.nami {
  height: calc(64px + var(--safe-b));
  background-color: #0b1029;
  background-image: var(--tile-seigaiha, none);
  background-size: 44px 22px;
  background-position: center top;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 26px);
}

/* ---------- カメラ ---------- */

.camera {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #05081a;
  padding: calc(var(--safe-t) + 8px) 0 calc(var(--safe-b) + 8px);
}

.cam-top { padding: 0 12px; }

.tape {
  display: block;
  width: 100%;
  height: 58px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(28, 39, 86, .95), rgba(14, 20, 49, .95));
  box-shadow: inset 0 0 0 1px rgba(227, 191, 104, .45);
}

.cam-hint {
  margin: 6px 0 4px;
  min-height: 1.7em;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--washi);
}
.cam-hint.good { color: var(--kin-200); }

.viewfinder {
  position: relative;
  flex: none;
  width: min(100vw, calc((100vh - 236px) * .75));
  width: min(100vw, calc((100dvh - 236px - var(--safe-t) - var(--safe-b)) * .75));
  aspect-ratio: 3 / 4;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
}

.viewfinder video,
.viewfinder canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.corner {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 4px solid rgba(245, 224, 163, .75);
  transition: border-color .25s, filter .25s, transform .25s;
  pointer-events: none;
}
.corner.tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.corner.tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; border-top-right-radius: 8px; }
.corner.bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; border-bottom-left-radius: 8px; }
.corner.br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; }

.viewfinder.aligned .corner {
  border-color: #ffe08a;
  filter: drop-shadow(0 0 8px rgba(255, 210, 110, .9));
}
.viewfinder.aligned .corner.tl { transform: translate(6px, 6px); }
.viewfinder.aligned .corner.tr { transform: translate(-6px, 6px); }
.viewfinder.aligned .corner.bl { transform: translate(6px, -6px); }
.viewfinder.aligned .corner.br { transform: translate(-6px, -6px); }

.viewfinder.aligned::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 60px rgba(255, 210, 110, .45);
  animation: vf-glow 1.2s ease-in-out infinite;
}
@keyframes vf-glow { 50% { opacity: .45; } }

.viewfinder.flash::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #fff;
  animation: flash-out .35s ease-out forwards;
}
@keyframes flash-out { from { opacity: 1; } to { opacity: 0; } }

.cam-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 18px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: .06em;
  color: var(--washi);
  background: rgba(9, 13, 36, .62);
  box-shadow: inset 0 0 0 1.5px rgba(227, 191, 104, .5);
  pointer-events: none;
}
.cam-guide:empty { display: none; }
.cam-guide.good {
  color: var(--ai-900);
  background: var(--gold);
  box-shadow: 0 0 24px rgba(255, 210, 110, .7);
  animation: pop .35s ease-out;
}
.cam-guide.left { animation: nudge-l 1s ease-in-out infinite; }
.cam-guide.right { animation: nudge-r 1s ease-in-out infinite; }

@keyframes pop { from { transform: translate(-50%, -50%) scale(.6); } 70% { transform: translate(-50%, -50%) scale(1.12); } }
@keyframes nudge-l { 50% { transform: translate(calc(-50% - 10px), -50%); } }
@keyframes nudge-r { 50% { transform: translate(calc(-50% + 10px), -50%); } }

.cam-bottom {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 6px 20px 0;
}

.cam-back {
  justify-self: start;
  appearance: none;
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  color: var(--kin-200);
  background: none;
  padding: 12px 8px;
  cursor: pointer;
}

.shutter {
  appearance: none;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  padding: 6px;
  border: 0;
  cursor: pointer;
  background: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 240, 200, .35), 0 6px 18px rgba(0, 0, 0, .5);
  transition: transform .12s, filter .3s, opacity .3s;
  touch-action: manipulation;
}
.shutter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid var(--ai-900);
  background: radial-gradient(circle at 40% 35%, #fffaf0, #f2dca2 70%);
}
.shutter:active { transform: scale(.94); }
.shutter.locked { filter: grayscale(.85) brightness(.6); }
.shutter.ready { animation: shutter-pulse 1.1s ease-in-out infinite; }
.shutter.shake { animation: shake .4s; }

@keyframes shutter-pulse {
  50% { box-shadow: 0 0 0 10px rgba(255, 214, 120, .25), 0 0 30px rgba(255, 214, 120, .8); }
}
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ---------- ごりやく えんしゅつ ---------- */

.blessing {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 12px) 16px calc(var(--safe-b) + 12px);
  background: radial-gradient(circle at 50% 42%, #2f3c7c 0%, #141c42 45%, var(--ai-950) 80%);
}

.b-rays {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 240vmax;
  height: 240vmax;
  translate: -50% -50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 224, 140, .22) 0deg 5deg, rgba(255, 224, 140, 0) 5deg 15deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, rgba(0, 0, 0, .6) 18%, transparent 42%);
  mask-image: radial-gradient(circle, #000 0%, rgba(0, 0, 0, .6) 18%, transparent 42%);
  opacity: 0;
  pointer-events: none;
}

.b-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.b-photo {
  position: relative;
  width: min(84vw, 420px, calc((100vh - 290px) * .75));
  width: min(84vw, 420px, calc((100dvh - 290px - var(--safe-t) - var(--safe-b)) * .75));
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(240, 210, 130, .9), 0 0 0 9px rgba(14, 20, 49, .9), 0 0 0 11px rgba(227, 191, 104, .6), 0 18px 60px rgba(0, 0, 0, .6);
}

.b-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

#photoFinal { opacity: 0; transition: opacity .8s ease; }

/* 文字は しゃしんから はみだして よい（まんなか ぞろえの まま りょうがわへ） */
.b-msg {
  position: absolute;
  left: 0;
  right: 0;
  top: 34%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  pointer-events: none;
}
.b-msg p { margin: 0; white-space: nowrap; flex: none; }

.b-main {
  font-family: var(--font-mincho);
  font-weight: 900;
  font-size: clamp(50px, 16vw, 78px);
  line-height: 1.2;
  letter-spacing: .04em;
  color: #ffe6a0;
  text-shadow:
    0 0 2px #6b4a12, 0 2px 0 #6b4a12, 0 0 18px rgba(255, 200, 90, .9), 0 0 40px rgba(255, 190, 80, .6);
  opacity: 0;
}

.b-sub {
  display: inline-block;
  margin-top: 10px !important;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 900;
  font-size: clamp(14px, 4vw, 17px);
  color: var(--washi);
  background: rgba(9, 13, 36, .72);
  box-shadow: inset 0 0 0 1px rgba(227, 191, 104, .6);
  opacity: 0;
}

.b-stamp {
  position: absolute;
  right: 6%;
  bottom: 5%;
  width: 27%;
  aspect-ratio: 1;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: center;
  gap: 2%;
  border-radius: 12%;
  color: #fff4e6;
  background: radial-gradient(circle at 35% 30%, #e0613f, var(--shu) 55%, var(--shu-deep));
  box-shadow: inset 0 0 0 3px rgba(255, 240, 225, .85), inset 0 0 0 6px var(--shu), inset 0 0 0 7.5px rgba(255, 240, 225, .7), 0 4px 14px rgba(0, 0, 0, .4);
  font-family: var(--font-mincho);
  font-weight: 900;
  font-size: clamp(22px, 6.6vw, 34px);
  line-height: 1.02;
  opacity: 0;
  rotate: -8deg;
}
.b-stamp span { writing-mode: vertical-rl; text-orientation: upright; }

.b-after {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  translate: 0 16px;
  pointer-events: none;
  transition: opacity .6s ease .3s, translate .6s ease .3s;
}

.hitokoto {
  margin: 0;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--washi);
}
.hitokoto-label {
  display: block;
  font-size: 12px;
  letter-spacing: .2em;
  color: var(--kin-400);
}

.b-actions { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.b-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.b-row .btn { min-height: 50px; padding: 10px 12px; }
.b-row .btn-gold { font-size: 17px; gap: 6px; }

.b-kumo {
  position: absolute;
  z-index: 3;
  width: min(56vw, 300px);
  height: auto;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .35));
}
.b-kumo.k1 { left: -6%; top: 8%; }
.b-kumo.k2 { right: -8%; top: 20%; transform: scaleX(-1); }
.b-kumo.k3 { left: -10%; bottom: 24%; width: min(46vw, 240px); }
.b-kumo.k4 { right: -6%; bottom: 10%; transform: scaleX(-1); width: min(48vw, 250px); }

.b-sparkle { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; pointer-events: none; }

.b-flash { position: absolute; inset: 0; z-index: 5; background: radial-gradient(circle at 50% 42%, #fff, #fff3c4 50%, #ffe08a); opacity: 0; pointer-events: none; }

/* 再生 */
.blessing.play .b-flash { animation: b-flash .9s ease-out forwards; }
.blessing.play .b-rays { animation: fade-in 1s .1s ease-out forwards, spin 50s linear infinite; }
.blessing.play .b-photo { animation: photo-in .9s cubic-bezier(.2, .9, .3, 1.2) both; }
.blessing.play .b-main { animation: main-in .7s .55s cubic-bezier(.2, .9, .3, 1.4) forwards; }
.blessing.play .b-sub { animation: fade-up .6s 1s ease-out forwards; }
.blessing.play .b-stamp { animation: stamp-in .45s 1.45s cubic-bezier(.3, 1.6, .5, 1) forwards; }
.blessing.play .b-kumo.k1 { animation: kumo-l 1.4s .2s cubic-bezier(.2, .8, .2, 1) forwards, drift 6s 1.6s ease-in-out infinite; }
.blessing.play .b-kumo.k2 { animation: kumo-r 1.4s .35s cubic-bezier(.2, .8, .2, 1) forwards, drift 7s 1.8s ease-in-out infinite; }
.blessing.play .b-kumo.k3 { animation: kumo-l 1.5s .5s cubic-bezier(.2, .8, .2, 1) forwards, drift 6.5s 2s ease-in-out infinite; }
.blessing.play .b-kumo.k4 { animation: kumo-r 1.5s .25s cubic-bezier(.2, .8, .2, 1) forwards, drift 7.5s 1.8s ease-in-out infinite; }

.blessing.done .b-main,
.blessing.done .b-sub,
.blessing.done .b-stamp { animation: none; opacity: 0; transition: opacity .5s; }
.blessing.done #photoFinal { opacity: 1; }
.blessing.done .b-after { opacity: 1; translate: 0 0; pointer-events: auto; }
.blessing.done .b-kumo.k1,
.blessing.done .b-kumo.k3 { animation: kumo-out-l .8s ease-in forwards; }
.blessing.done .b-kumo.k2,
.blessing.done .b-kumo.k4 { animation: kumo-out-r .8s ease-in forwards; }

@keyframes b-flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fade-in { to { opacity: 1; } }
@keyframes spin { to { rotate: 360deg; } }
@keyframes photo-in { from { transform: scale(1.08); filter: brightness(2.2); } to { transform: none; filter: none; } }
@keyframes main-in { from { opacity: 0; transform: scale(2.2); } to { opacity: 1; transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes stamp-in { from { opacity: 0; scale: 2.6; } to { opacity: 1; scale: 1; } }
@keyframes kumo-l { from { opacity: 0; translate: -70vw 0; } to { opacity: 1; translate: 0 0; } }
@keyframes kumo-r { from { opacity: 0; translate: 70vw 0; } to { opacity: 1; translate: 0 0; } }
@keyframes drift { 0%, 100% { margin-top: 0; } 50% { margin-top: -10px; } }
@keyframes kumo-out-l { from { opacity: 1; translate: 0 0; } to { opacity: 0; translate: -45vw 0; } }
@keyframes kumo-out-r { from { opacity: 1; translate: 0 0; } to { opacity: 0; translate: 45vw 0; } }

.blessing.shake .b-stage { animation: stage-shake .35s; }
@keyframes stage-shake {
  20% { transform: translate(-5px, 3px); }
  40% { transform: translate(5px, -3px); }
  60% { transform: translate(-3px, -2px); }
  80% { transform: translate(3px, 2px); }
}

/* ---------- トースト・その他 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 28px);
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  color: var(--washi);
  background: rgba(9, 13, 36, .94);
  box-shadow: inset 0 0 0 1px rgba(227, 191, 104, .6), 0 10px 30px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.rotate-note {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  background: var(--ai-900);
  font-weight: 900;
  font-size: 20px;
  color: var(--kin-200);
}

@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate-note { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-kumo--l, .hero-kumo--r, .btn-gold::after { animation: none; }
  .blessing.play .b-rays { animation: fade-in 1s ease-out forwards; }
  .blessing.play .b-kumo.k1, .blessing.play .b-kumo.k2,
  .blessing.play .b-kumo.k3, .blessing.play .b-kumo.k4 { animation: fade-in .8s ease-out forwards; }
}

/* ---------- 利用規約 ---------- */

.doc {
  flex: 1;
  margin-top: 18px;
  padding: 22px 20px 26px;
  border-radius: 16px;
  background: rgba(246, 239, 221, .97);
  color: #2a2a35;
  font-family: "Hiragino Sans", "Yu Gothic", var(--font-maru);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.85;
  box-shadow: 0 0 0 1px rgba(227, 191, 104, .7), 0 0 0 6px rgba(14, 20, 49, .6), 0 0 0 7px rgba(227, 191, 104, .45);
}
.doc h1 {
  margin: 0 0 4px;
  font-family: var(--font-mincho);
  font-weight: 900;
  font-size: 24px;
  text-align: center;
  color: var(--ai-800);
  letter-spacing: .12em;
}
.doc h2 {
  margin: 26px 0 6px;
  padding-left: 10px;
  font-family: var(--font-mincho);
  font-weight: 700;
  font-size: 17px;
  color: var(--ai-800);
  border-left: 4px solid var(--kin-500);
}
.doc p, .doc li { margin: 0 0 8px; }
.doc ol, .doc ul { margin: 0 0 8px; padding-left: 1.4em; }
.doc a { color: #7a5615; }
.doc .doc-lead { text-align: center; color: #5b5a66; font-size: 13px; margin-bottom: 18px; }
.doc .important {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff8e3;
  box-shadow: inset 0 0 0 1.5px var(--kin-500);
  font-weight: 700;
}
.doc .date { margin-top: 24px; text-align: right; color: #5b5a66; font-size: 13px; }

.back-link { display: inline-block; margin: 18px 0 4px; font-weight: 700; letter-spacing: .06em; }

.hero--small .logo-sm { font-size: 18px; }
.hero--small .logo-lg { font-size: 38px; }
.hero--small .hero-kumo { max-width: 86px; }
.hero--small a { text-decoration: none; }
