/* ===== 奉納ページ(スマホ) ===== */

:root {
  --shu: #c8361f;        /* 朱色 */
  --shu-dark: #9e2614;
  --ink: #222222;        /* 文字 */
  --ink-soft: #6b6b6b;
  --paper: #f5f5f5;      /* 背景(薄いグレー) */
  --paper-deep: #e9e9e9;
  --card: #ffffff;       /* カード・ボタンの白 */
  --gold: #b07a1c;
  --line: #e0e0e0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--paper);
}

.app {
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 16px 20px 32px;
  display: flex;
  flex-direction: column;
}

.mincho { font-family: 'Hiragino Mincho ProN', 'Yu Mincho', 'YuMincho', serif; }

/* ---------- 上部(もどる+進み具合) ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  margin-bottom: 12px;
}
.back {
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 15px;
  padding: 8px 4px;
  cursor: pointer;
}
.progress {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--paper-deep);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--shu);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.progress-label {
  font-size: 13px;
  color: var(--ink-soft);
  min-width: 2.5em;
  text-align: right;
}

/* ---------- 見出し ---------- */
.step { animation: stepIn 0.28s ease; display: flex; flex-direction: column; flex: 1; }
@keyframes stepIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}
.step-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.45;
  margin: 8px 0 6px;
}
.step-note {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 18px;
}

/* ---------- 選択肢ボタン ---------- */
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.choice:active { transform: scale(0.98); }
.choice.selected {
  border-color: var(--shu);
  background: #fde9e3;
}
.choice .emoji { font-size: 24px; width: 32px; text-align: center; }
.choice .check {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--line);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 15px;
  color: #fff;
}
.choice.selected .check { background: var(--shu); border-color: var(--shu); }
.choice.selected .check::after { content: '✓'; }
.choices.grid { display: grid; grid-template-columns: 1fr 1fr; }
.choices.grid .choice { justify-content: center; text-align: center; }

/* ---------- 入力欄 ---------- */
.field {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font-size: 18px;
  font-family: inherit;
  resize: none;
  outline: none;
}
.field:focus { border-color: var(--shu); }
textarea.field { min-height: 110px; line-height: 1.5; }
.counter {
  text-align: right;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 6px;
}

/* ---------- メインボタン ---------- */
.spacer { flex: 1; min-height: 24px; }
.primary {
  width: 100%;
  min-height: 58px;
  border: none;
  border-radius: 999px;
  background: var(--shu);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--shu-dark);
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.2s;
}
.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shu-dark); }
.primary:disabled { opacity: 0.35; cursor: default; }
.link-btn {
  display: block;
  margin: 16px auto 0;
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- TOP ---------- */
.top {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 24px;
}
.top .brand-logo { height: 30px; }
.top h1 {
  margin: 6px 0 4px;
  font-size: 36px;
  letter-spacing: 0.12em;
  line-height: 1.3;
}
.top .torii { width: 190px; margin: 18px 0 10px; }
.top .lead { font-size: 17px; line-height: 1.8; margin: 8px 0 18px; }
.badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.badge {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--ink-soft);
}
.top-steps {
  width: 100%;
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--card);
  border: 1px dashed var(--line);
  text-align: left;
  font-size: 14px;
  line-height: 1.9;
  list-style: none;
}
.top-steps li::marker { content: none; }
.top-steps b { color: var(--shu); margin-right: 6px; }
.demo-links {
  margin-top: 20px;
  font-size: 12px;
  color: var(--ink-soft);
  display: flex;
  gap: 16px;
  justify-content: center;
}
.demo-links a, .demo-links button {
  color: var(--ink-soft);
  font-size: 12px;
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

/* ---------- 絵馬プレビュー ---------- */
.ema-preview {
  display: flex;
  justify-content: center;
  margin: 18px 0 8px;
  font-size: 18px;
}

/* ---------- 奉納中 ---------- */
.sending {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.sending .ema-preview { animation: offer 1.6s ease-in forwards; }
@keyframes offer {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  30% { transform: translateY(14px) scale(1.02); opacity: 1; }
  100% { transform: translateY(-70vh) scale(0.5) rotate(-6deg); opacity: 0; }
}
.sending p { font-size: 18px; font-weight: 700; letter-spacing: 0.1em; }
.error {
  color: var(--shu-dark);
  font-size: 14px;
  margin: 12px 0 0;
  text-align: center;
}

/* ---------- 奉納完了 ---------- */
.done {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.done .seal {
  margin-top: 20px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 4px solid var(--shu);
  color: var(--shu);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
  transform: rotate(-12deg);
  animation: stamp 0.45s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes stamp {
  from { transform: rotate(-12deg) scale(2.2); opacity: 0; }
  to { transform: rotate(-12deg) scale(1); opacity: 1; }
}
.done h2 { font-size: 26px; margin: 18px 0 6px; letter-spacing: 0.1em; }
.done .lead { font-size: 16px; line-height: 1.7; margin: 0; }
.summoning {
  margin-top: 18px;
  font-size: 15px;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
}
.summoning::after {
  content: '';
  animation: dots 1.2s steps(4) infinite;
}
@keyframes dots {
  0% { content: ''; } 25% { content: '・'; } 50% { content: '・・'; } 75% { content: '・・・'; }
}

/* ===================== 結果:守護神と三社参り ===================== */
.result { align-items: center; text-align: center; padding-top: 12px; overflow-x: clip; } /* 後光が横にはみ出してもスクロールしない */
.reveal-lead {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 8px 0 14px;
}

/* ---------- 神様シール ---------- */
.sticker-scene {
  position: relative;
  width: 100%;                   /* 画面の横幅いっぱい */
  max-width: 400px;
  aspect-ratio: 23 / 31;
  perspective: 1400px;
}
.sticker-scene::before {         /* 後光 */
  content: '';
  position: absolute;
  inset: -60px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(230, 170, 60, 0.28) 0 7deg, transparent 7deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%);
          mask: radial-gradient(circle, #000 25%, transparent 70%);
  opacity: 0;
  transition: opacity 0.6s;
  animation: spin 16s linear infinite;
}
.sticker-scene.revealed::before { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

.sticker {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(.3, 1.3, .5, 1);
  animation: wobble 1.8s ease-in-out infinite;
}
.sticker.flipped { transform: rotateY(180deg); animation: none; }
@keyframes wobble {
  0%, 100% { transform: rotate(-2deg) scale(1); }
  50% { transform: rotate(2deg) scale(1.03); }
}

.sticker-face {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  -webkit-backface-visibility: hidden;
          backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(60, 30, 10, 0.3);
}

/* 裏面 */
.sticker-back {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 6px solid #f5e6c4;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 220, 140, 0.35), transparent 60%),
    repeating-linear-gradient(45deg, #b8321c 0 10px, #a82c18 10px 20px);
}
.back-mark {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 4px solid #f5e6c4;
  color: #f5e6c4;
  display: grid;
  place-items: center;
  font-size: 66px;
  font-weight: 800;
}
.back-text {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.55; } }

/* 表面(ホログラム風) */
.sticker-front {
  --god: #b07a1c;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 7px solid #fff;
  outline: 3px solid var(--god);
  outline-offset: -10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 60%),
    conic-gradient(from 200deg at 50% 40%, #ffd6e8, #d7f0ff, #e6ffd9, #fff2c2, #ffd6e8);
}
.sticker-no {
  align-self: flex-start;
  margin: 14px 0 0 16px;
  font-size: 11px;
  font-weight: 800;
  color: var(--god);
  letter-spacing: 0.08em;
}
.sticker-art {
  position: relative;
  width: 150px;
  height: 150px;
  margin-top: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 30%, rgba(255, 255, 255, 0.4) 70%);
  border: 4px solid var(--god);
  display: grid;
  place-items: center;
}
.sticker-art { overflow: hidden; }
.god-face {                      /* 顔を中心に切り抜いた画像(位置はJSで計算) */
  position: absolute;
  max-width: none;
  opacity: 0;
}
.god-face.ready { opacity: 1; }

/* 画像があるときのシール:イラストを全面に */
.sticker-front.has-image { justify-content: flex-end; }
.sticker-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sticker-front.has-image::after {  /* 名前を読みやすくする下側の影 */
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38%;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.85));
}
.sticker-front.has-image .sticker-no {
  position: absolute;
  top: 12px;
  left: 12px;
  margin: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  z-index: 1;
}
.sticker-name.long { font-size: 13px; padding: 6px 10px; max-width: 94%; white-space: nowrap; }
.sticker-front.has-image .sticker-name,
.sticker-front.has-image .sticker-brand { position: relative; z-index: 1; }
.sticker-front.has-image .sticker-brand { margin-top: 6px; }
.god-emoji { font-size: 76px; line-height: 1; }
.sticker-name {
  margin-top: 14px;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--god);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.05em;
  max-width: 88%;
  line-height: 1.25;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}
.sticker-brand {
  margin-top: auto;
  margin-bottom: 14px;
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--ink-soft);
}
.sticker-shine {                 /* キラッと光る帯 */
  position: absolute;
  inset: -50%;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.85) 50%, transparent 60%);
  transform: translateX(-100%);
  pointer-events: none;
}
.revealed .sticker-shine { animation: shine 3.2s ease-in-out 0.1s infinite; }
@keyframes shine {
  0% { transform: translateX(-100%); }
  35%, 100% { transform: translateX(100%); }
}

/* 開封時のキラキラ */
.spark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px;
  background: #f2c14e;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: burst 1.1s ease-out forwards;
  pointer-events: none;
}
@keyframes burst {
  from { transform: translate(0, 0) scale(0.4); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) scale(1.4) rotate(120deg); opacity: 0; }
}

/* ---------- 開封後に出てくる部分 ---------- */
.after {
  width: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
}
.after.show { display: flex; animation: rise 0.6s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }

.god-name {
  margin: 22px 0 6px;
  font-size: 30px;
  letter-spacing: 0.08em;
}
.god-line {
  position: relative;
  margin: 6px 0 0;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--card);
  border: 2px solid var(--line);
  font-size: 15px;
  line-height: 1.6;
}
.shot-hint {
  margin: 30px 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* ---------- 三社参りプラン(昔の木の看板) ---------- */
.plan-sign {
  position: relative;
  width: 100%;
  padding-top: 30px;
}
.plan-sign::before, .plan-sign::after {   /* 看板を吊るす縄 */
  content: '';
  position: absolute;
  top: 0;
  width: 5px;
  height: 40px;
  border-radius: 3px;
  background: repeating-linear-gradient(160deg, #d8bf8a 0 4px, #9c7a45 4px 7px);
}
.plan-sign::before { left: 18%; }
.plan-sign::after { right: 18%; }

.sign-board {
  position: relative;
  padding: 26px 22px 18px;
  border-radius: 4px;
  color: #2b180a;
  text-align: left;
  background:
    radial-gradient(ellipse 46px 12px at 84% 63%, rgba(120, 72, 30, 0.22), transparent 70%),
    radial-gradient(ellipse 30px 9px at 14% 30%, rgba(120, 72, 30, 0.16), transparent 70%),
    repeating-linear-gradient(179deg, rgba(120, 72, 30, 0.08) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(181deg, rgba(255, 244, 222, 0.14) 0 2px, transparent 2px 11px),
    radial-gradient(ellipse at 30% 15%, rgba(255, 246, 226, 0.45), transparent 65%),
    linear-gradient(180deg, #ecd0a4, #e0bd8a 55%, #d2ab76);
  box-shadow:
    inset 0 0 0 5px #8a5a2e,
    inset 0 0 0 7px rgba(255, 240, 210, 0.3),
    inset 0 0 26px rgba(90, 50, 16, 0.25),
    0 10px 20px rgba(60, 30, 10, 0.35);
}
.nail {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e4ddd0, #7a7064 55%, #3a332c);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}
.nail.tl { top: 13px; left: 13px; }
.nail.tr { top: 13px; right: 13px; }
.nail.bl { bottom: 13px; left: 13px; }
.nail.br { bottom: 13px; right: 13px; }

/* 彫り込んだような文字 */
.sign-kicker, .sign-title, .sign-sub, .sign-role, .sign-name, .sign-ex, .sign-brand {
  text-shadow: 0 1px 0 rgba(255, 248, 232, 0.6);
}
.sign-kicker { text-align: center; font-size: 13px; font-weight: 700; color: #3a2210; }
.sign-title {
  margin: 2px 0 4px;
  text-align: center;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
}
.sign-sub { margin: 0 0 14px; text-align: center; font-size: 13px; font-weight: 700; color: #3a2210; }

.sign-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(90, 50, 16, 0.4);
  box-shadow: 0 1px 0 rgba(255, 236, 200, 0.3);
}
.sign-item {
  display: grid;
  grid-template-columns: 30px 54px 1fr;
  column-gap: 12px;
  align-items: center;
  padding: 13px 2px;
  border-bottom: 1px solid rgba(90, 50, 16, 0.4);
  box-shadow: 0 1px 0 rgba(255, 236, 200, 0.3);
}
.sign-stamp {                    /* 朱印 */
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: #b3301b;
  color: #f6e5c6;
  font-size: 17px;
  font-weight: 800;
  transform: rotate(-6deg);
  box-shadow: inset 0 0 0 2px rgba(246, 229, 198, 0.55), 0 1px 2px rgba(0, 0, 0, 0.3);
}
.sign-art {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #f1dfbd;
  border: 2px solid #4a2c12;
  box-shadow: 0 0 0 2px rgba(255, 236, 200, 0.35);
}
.sign-art .god-emoji { font-size: 26px; }
.sign-main { min-width: 0; }
.sign-role { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; color: #4a2c12; }
.sign-name { font-size: 20px; font-weight: 900; line-height: 1.3; }
.sign-ex { font-size: 12.5px; font-weight: 700; color: #3a2210; margin-top: 1px; }
.sign-brand {
  margin-top: 12px;
  text-align: right;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: rgba(43, 24, 10, 0.7);
}
.sign-brand .logo-inline { opacity: 0.75; }


/* ---------- 登録・インスタ ---------- */
.cta-box, .insta-box {
  width: 100%;
  margin-top: 26px;
  padding: 20px 18px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
}
.cta-title { margin: 0 0 8px; font-size: 19px; }
.logo-inline { height: 0.82em; width: auto; vertical-align: -0.04em; margin: 0 0.18em; }
.sticker-brand .logo-inline, .sign-brand .logo-inline { height: 1.15em; vertical-align: -0.2em; margin: 0 0.4em 0 0; }
.cta-head { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 14px; }
.cta-head .cta-title { margin: 0; }
.app-icon { width: 52px; height: 52px; border-radius: 12px; flex: none; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); }
.coupon {
  margin: 0 0 16px;
  padding: 14px 12px;
  border: 2px dashed #e3a497;
  border-radius: 12px;
  background: #fff6f3;
}
.coupon p { margin: 0; }
.coupon-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.coupon-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin: 6px 0; }
.coupon-code { font-size: 22px; font-weight: 900; letter-spacing: 0.08em; color: var(--ink); user-select: all; }
.copy-btn {
  display: inline-flex;
  flex: none;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.copy-btn:active { background: #f0f0f0; }
.copy-btn.done { border-color: #2f8a63; color: #2f8a63; }
.copy-btn svg { flex: none; }
.coupon-lead { font-size: 14px; font-weight: 700; }
.cta-text { margin: 0 0 16px; font-size: 14px; line-height: 1.7; color: var(--ink-soft); }
.cta-btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.cta-note { margin: 10px 0 0; font-size: 12px; color: var(--ink-soft); }
.store-buttons { display: flex; flex-direction: column; gap: 12px; }
.store-note { margin: -4px 0 0; font-size: 12px; color: var(--ink-soft); }
.store-other { font-size: 12px; color: var(--ink-soft); }

.insta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border-radius: 999px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(90deg, #f58529, #dd2a7b 50%, #8134af);
}
