/* =========================
   全体（赤い和紙）
========================= */
.container {
  position: relative;
  z-index: 3;
}

.ema-shrine {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #b31217 0%, #7a0f14 100%);
  min-height: 100vh; /* ★これ重要 */
}

/* 和紙テクスチャ */
.washi-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.08), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(0,0,0,0.15), transparent 50%);
  opacity: 0.2;
  pointer-events: none;
}

/* =========================
   タイトル
========================= */

.section-title {
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #f3ead8;
  text-shadow:
    0 2px 6px rgba(0,0,0,0.6),
    0 0 12px rgba(0,0,0,0.3);
}

.ema-subtitle {
  letter-spacing: 0.25em;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.ema-header {
  position: relative;
  padding: 80px 20px 60px;
  overflow: visible;

  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.ema-header p {
  color: #e6c66a !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.section-title-small {
  position: relative;
  display: inline-block;

  color: #e6c66a;
  font-weight: 600;
  letter-spacing: 0.1em;

  /* 基本の影（浮かせる） */
  text-shadow:
    0 1px 1px rgba(0,0,0,0.5),
    0 2px 6px rgba(0,0,0,0.25);

  /* 微妙な金の発光 */
  filter: drop-shadow(0 0 6px rgba(212,175,55,0.15));
}

.ema-header p.text-muted {
  color: #c0c0c0 !important;
}

/* しめ縄＋神社背景 */
.ema-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;

  width: 100%;
  height: 560px;

  background: url("/static/images/shimenawa.png") no-repeat center top;
  background-size: contain;

  z-index: 0;
  opacity: 0.95;
  pointer-events: none;

  /* ★これ追加 */
  transform: translateY(-100px) translateX(-10px) scale(1.05);
  transform-origin: center;
}

.ema-header::after {
  content: "";
  position: absolute;

  top: -80px;
  left: 0;

  width: 100%;
  height: 760px; /* ←少し伸ばす（重要） */

  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.55),
    rgba(0,0,0,0.30),
    rgba(0,0,0,0.15),
    rgba(0,0,0,0.00)
  );

  z-index: 0;
  pointer-events: none;
}

/* 中のテキストを前面に */
.ema-header > * {
  position: relative;
  z-index: 1;
}

/* =========================
   ボタン
========================= */

.ema-btn {
  display: inline-block;

  background: rgba(0, 0, 0, 0.35);
  color: #f3ead8;

  border: 1px solid rgba(230, 198, 106, 0.25);
  border-radius: 12px;

  padding: 10px 24px;

  font-size: 1.0rem;
  font-weight: 600;
  letter-spacing: 0.15em;

  backdrop-filter: blur(10px);

  box-shadow:
    0 10px 25px rgba(0,0,0,0.25),
    inset 0 0 10px rgba(230,198,106,0.08);

  transition: 0.25s ease;

  text-decoration: none;
}

#shuffleBtn {
  display: block;
  margin: 0 auto;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.ema-btn:hover {
  transform: translateY(-3px);
  background: #a32626;
  color: white;
}

/* =========================
   絵馬カード
========================= */

.ema-card {
  position: relative;
  padding: 52px 10px 10px;
  height: 360px;
  
  box-shadow: 0 18px 40px rgba(0,0,0,0.14);
  animation: sway 5s ease-in-out infinite;

  clip-path: polygon(
    0% 22%,
    50% 0%,
    100% 22%,
    100% 100%,
    0% 100%
  );
}

.ema-blank {
  height: 30px;
}


.ema-image {
  height: 250px;
  object-fit: cover;
  width: 100%;
}

.ema-card-washi {
  background: linear-gradient(180deg, #f7e7c6 0%, #e2c28a 100%);
  border-radius: 10px;
  transition: 0.25s;
}

.ema-card-washi:hover {
  transform: translateY(-6px) rotate(0deg);
}

/* 木目 */
.ema-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background:
    repeating-linear-gradient(
      90deg,
      #8b5a2b 0px,
      #8b5a2b 2px,
      transparent 2px,
      transparent 6px
    );
  pointer-events: none;
}

/* =========================
   紐
========================= */

.ema-rope {
  position: relative;
  width: 34px;
  height: 34px;
  margin: -52px auto 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff8a8a, #9f1414);
}

/* =========================
   テキスト
========================= */

.ema-title {
  text-align: center;
  font-weight: 700;
  color: #3d2d1e;
  margin-bottom: 18px;
}

.ema-body {
  white-space: pre-wrap;
  line-height: 1.9;
  min-height: 120px;
  color: #3e3021;
}

.ema-date {
  margin-top: 18px;
  font-size: 0.8rem;
  color: rgba(60,40,20,0.55);
}

.ema-name {
  position: absolute;

  right: 16px;
  bottom: 6px;

  max-width: 65%;

  color: rgba(50,30,10,0.72);
  font-size: 0.9rem;

  text-align: right;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================
   アニメーション
========================= */

@keyframes sway {
  0% { transform: rotate(-1deg); }
  50% { transform: rotate(1deg); }
  100% { transform: rotate(-1deg); }
}

/* =========================
   市松フレーム（必要分）
========================= */

.ema-frame {
  position: absolute;
  width: 180px;
  height: 180px;
  opacity: 0.25;
  pointer-events: none;

  background-image:
    linear-gradient(45deg, #f4d03f 25%, transparent 25%),
    linear-gradient(-45deg, #f4d03f 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f4d03f 75%),
    linear-gradient(-45deg, transparent 75%, #f4d03f 75%);

  background-size: 40px 40px;
}

.ema-frame.tl { top: 0; left: 0; }
.ema-frame.tr { top: 0; right: 0; transform: scaleX(-1); }
.ema-frame.bl { bottom: 0; left: 0; transform: scaleY(-1); }
.ema-frame.br { bottom: 0; right: 0; transform: scale(-1); }

/* =========================
   粒子（修正版：必ず見える版）
========================= */

.particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.particles span {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 200, 0.9);
  box-shadow: 0 0 10px rgba(255, 240, 160, 0.8);

  animation: floatParticle 10s linear infinite;
}

/* 下側 */
.particles span:nth-child(1) { --x: 10; --y: 90; --dur: 8s; }
.particles span:nth-child(2) { --x: 20; --y: 70; --dur: 12s; }
.particles span:nth-child(3) { --x: 15; --y: 95; --dur: 10s; }
.particles span:nth-child(4) { --x: 25; --y: 60; --dur: 14s; }

/* 下補強 */
.particles span:nth-child(13) { --x: 20; --y: 85; --dur: 11s; }
.particles span:nth-child(14) { --x: 15; --y: 78; --dur: 13s; }

/* 中間 */
.particles span:nth-child(5) { --x: 40; --y: 10; --dur: 9s; }
.particles span:nth-child(6) { --x: 35; --y: 5;  --dur: 11s; }
.particles span:nth-child(7) { --x: 20; --y: 20; --dur: 13s; }
.particles span:nth-child(8) { --x: 30; --y: 30; --dur: 15s; }

/* 中間補強 */
.particles span:nth-child(15) { --x: 10; --y: 35; --dur: 10s; }
.particles span:nth-child(16) { --x: 25; --y: 25; --dur: 12s; }

/* 上側 */
.particles span:nth-child(9)  { --x: 25; --y: 15; --dur: 12s; }
.particles span:nth-child(10) { --x: 40; --y: 40; --dur: 10s; }
.particles span:nth-child(11) { --x: 15; --y: 20; --dur: 14s; }
.particles span:nth-child(12) { --x: 35; --y: 50; --dur: 9s; }

/* 上補強 */
.particles span:nth-child(17) { --x: 20; --y: 25; --dur: 11s; }
.particles span:nth-child(18) { --x: 15; --y: 18; --dur: 13s; }

/* 左側補強 */
.particles span:nth-child(19) { --x: 25; --y: 20; --dur: 10s; }
.particles span:nth-child(20) { --x: 20; --y: 40; --dur: 12s; }
.particles span:nth-child(21) { --x: 15; --y: 60; --dur: 14s; }
.particles span:nth-child(22) { --x: 10; --y: 80; --dur: 11s; }

/* 浮遊 */
@keyframes floatParticle {
  0% {
    opacity: 0;
    transform: translateY(0);
  }

  20% {
    opacity: 1;
  }

  100% {
    transform: translateY(-300px);
    opacity: 0;
  }
}


.ema-card form {
    position: absolute;
  left: 12px;
  bottom: 12px;
  margin: 0;
  opacity: 0;
  transition: 0.2s;
}

.ema-card:hover form {
  opacity: 1;
}



.ema-counter-section {
  display: flex;
  justify-content: center;
  align-items: center;

  margin: 50px 0;
}

.counter-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  min-width: 200px;

  padding: 18px 30px;
  border-radius: 16px;

  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(230, 198, 106, 0.25);

  backdrop-filter: blur(10px);

  box-shadow:
    0 12px 35px rgba(0,0,0,0.35),
    inset 0 0 20px rgba(230,198,106,0.08);

  transition: 0.3s ease;
}

.counter-widget::before {
  content: "";
  position: absolute;
  inset: -50%;

  background: radial-gradient(
    circle at center,
    rgba(230, 198, 106, 0.15),
    transparent 60%
  );

  animation: glowMove 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes glowMove {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-10px); opacity: 0.7; }
}

.counter-widget:hover {
  transform: translateY(-3px);
  box-shadow:
    0 18px 45px rgba(0,0,0,0.45),
    inset 0 0 25px rgba(230,198,106,0.12);
}

.counter-label {
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  color: rgba(230, 198, 106, 0.75);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.counter-value {
  font-size: 2.8rem;
  font-weight: 700;
  color: #f3ead8;

  line-height: 1;
  letter-spacing: 0.18em; /* ←ここ重要（ゼロ埋め映え） */

  font-variant-numeric: tabular-nums;
  font-family: "Courier New", monospace; /* ←追加：機械感 */

  text-shadow:
    0 0 18px rgba(230,198,106,0.25);
}

.counter-unit {
  font-size: 0.75rem;
  margin-top: 4px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.15em;
}

/* =========================
   奉納ルール
========================= */
.ema-rules {
  margin-bottom: 24px;
  padding: 16px 18px;
  border-radius: 12px;

  background:
    linear-gradient(
      rgba(255,255,255,0.65),
      rgba(255,255,255,0.45)
    );

  border: 1px solid rgba(120,70,40,0.15);

  color: #4b2b1f;
  font-size: 14px;
  line-height: 1.8;
}

.ema-rules-title {
  font-weight: bold;
  margin-bottom: 8px;
  color: #7a0f14;
}

.ema-rules ul {
  margin: 0;
  padding-left: 18px;
}

.ema-rules li {
  margin-bottom: 4px;
}

/* =========================
   絵馬ID
========================= */

.ema-id {
  position: absolute;

  left: 16px;
  bottom: 10px;

  z-index: 30;

  font-size: 10px;
  letter-spacing: 0.15em;

  color: rgba(70,40,20,0.55);

  font-family: "Courier New", monospace;

  text-shadow:
    0 1px 2px rgba(255,255,255,0.25);
}