/* ========================================
   和風占い処 - Traditional Japanese Fortune
   ======================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --washi: #F5F0E8;
  --vermillion: #B33B24;
  --pine: #2C4A1E;
  --gold: #8B6914;
  --text: #1A1A1A;
  --sand: #C4B99A;
  --wood-light: #D4A574;
  --wood-dark: #6B4226;
  --wood-mid: #8B6B4A;
  --ink: #2A2A2A;
}

body {
  font-family: "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-weight: 400;
  color: var(--text);
  background-color: var(--washi);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.8;
}

/* --- Washi paper texture overlay --- */
.washi-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(180, 165, 140, 0.03) 2px,
      rgba(180, 165, 140, 0.03) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 3px,
      rgba(160, 145, 120, 0.02) 3px,
      rgba(160, 145, 120, 0.02) 6px
    ),
    radial-gradient(ellipse at 20% 50%, rgba(200, 180, 150, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 30%, rgba(190, 170, 140, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(210, 190, 160, 0.05) 0%, transparent 40%);
}

/* --- Container --- */
.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  position: relative;
  z-index: 1;
}

/* --- 家紋 Kamon ornament --- */
.kamon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--vermillion);
  margin: 0 auto 16px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kamon::before {
  content: "";
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--vermillion);
  position: absolute;
}

.kamon::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--vermillion);
  position: absolute;
}

.kamon-small {
  width: 40px;
  height: 40px;
  border-width: 1.5px;
  margin-bottom: 12px;
}

.kamon-small::before {
  width: 26px;
  height: 26px;
  border-width: 1px;
}

.kamon-small::after {
  width: 10px;
  height: 10px;
}

/* --- Decorative line --- */
.decorative-line {
  text-align: center;
  color: var(--sand);
  font-size: 14px;
  letter-spacing: 4px;
  margin: 8px 0;
  user-select: none;
}

/* --- Shrine Header --- */
.shrine-header {
  text-align: center;
  padding: 20px 0 10px;
}

.main-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 16px;
  color: var(--ink);
  margin: 16px 0 8px;
  text-indent: 16px;
}

.subtitle {
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 6px;
  margin-bottom: 8px;
}

/* --- 縦罫 Tate divider --- */
.tate-divider {
  text-align: center;
  padding: 20px 0;
  user-select: none;
}

.tate-line {
  color: var(--sand);
  font-size: 24px;
  line-height: 1;
}

/* --- Section headers --- */
.section-header {
  text-align: center;
  margin-bottom: 28px;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 12px;
  color: var(--ink);
  text-indent: 12px;
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--wood-mid);
  letter-spacing: 2px;
}

/* --- おみくじ Box --- */
.omikuji-box {
  width: 160px;
  height: 220px;
  margin: 0 auto 24px;
  background:
    linear-gradient(135deg, #3A2A1A 0%, #2A1E12 50%, #3A2A1A 100%);
  border: 3px solid var(--wood-dark);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.3),
    0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.3s ease;
}

.omikuji-box:hover {
  transform: translateY(-2px);
}

.omikuji-box::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border: 1px solid rgba(212, 165, 116, 0.3);
  border-radius: 2px;
}

.omikuji-box-inner {
  text-align: center;
}

.omikuji-label {
  color: var(--wood-light);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.omikuji-sticks {
  display: flex;
  justify-content: center;
  gap: 3px;
  color: var(--wood-light);
  font-size: 16px;
  opacity: 0.6;
}

/* --- 絵馬 Button --- */
.ema-button {
  display: block;
  margin: 0 auto 32px;
  padding: 14px 48px;
  background:
    linear-gradient(180deg, #E8D5B0 0%, #D4B88A 30%, #C4A672 70%, #B89860 100%);
  border: 2px solid var(--wood-dark);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.ema-button:hover {
  transform: translateY(-1px);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ema-button:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.ema-text {
  font-family: "Noto Serif JP", serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--wood-dark);
  letter-spacing: 8px;
  text-indent: 8px;
}

/* --- おみくじ Result --- */
.omikuji-result {
  display: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.omikuji-result.visible {
  display: block;
  opacity: 1;
}

/* 朱印 Stamp effect */
.result-stamp {
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
  border: 4px solid var(--vermillion);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transform: rotate(-5deg);
  box-shadow:
    0 0 0 2px rgba(179, 59, 36, 0.1),
    inset 0 0 0 2px rgba(179, 59, 36, 0.1);
}

.result-stamp::before {
  content: "";
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border: 1px solid rgba(179, 59, 36, 0.3);
  border-radius: 50%;
}

.stamp-text {
  font-size: 36px;
  font-weight: 700;
  color: var(--vermillion);
  letter-spacing: 4px;
}

/* 和歌 Box */
.waka-box {
  background: rgba(245, 240, 232, 0.6);
  border-left: 3px solid var(--vermillion);
  border-right: 3px solid var(--vermillion);
  padding: 20px 24px;
  margin: 0 auto 24px;
  max-width: 400px;
  text-align: center;
}

.waka-text {
  font-size: 15px;
  line-height: 2;
  color: var(--ink);
  letter-spacing: 1px;
}

/* Fortune categories */
.fortune-categories {
  max-width: 400px;
  margin: 0 auto;
}

.fortune-category {
  display: flex;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--sand);
}

.fortune-category:last-child {
  border-bottom: none;
}

.category-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--vermillion);
  min-width: 56px;
  letter-spacing: 2px;
}

.category-value {
  font-size: 14px;
  color: var(--text);
  padding-left: 16px;
  line-height: 1.7;
}

/* --- 九星気学 Form --- */
.kyusei-form {
  max-width: 320px;
  margin: 0 auto;
}

.input-group {
  margin-bottom: 16px;
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--wood-mid);
  letter-spacing: 4px;
  margin-bottom: 6px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-wrapper input {
  flex: 1;
  padding: 10px 14px;
  font-family: "Noto Serif JP", serif;
  font-size: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--sand);
  border-radius: 2px;
  outline: none;
  transition: border-color 0.3s ease;
}

.input-wrapper input:focus {
  border-color: var(--vermillion);
}

.input-wrapper input::placeholder {
  color: var(--sand);
  font-size: 13px;
}

.input-suffix {
  font-size: 14px;
  color: var(--wood-mid);
}

/* --- 九星 Result --- */
.kyusei-result {
  display: none;
  opacity: 0;
  transition: opacity 0.8s ease;
  text-align: center;
  margin-top: 28px;
}

.kyusei-result.visible {
  display: block;
  opacity: 1;
}

.star-circle {
  width: 140px;
  height: 140px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 3px solid var(--pine);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(44, 74, 30, 0.05);
}

.star-circle::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border: 1px solid rgba(44, 74, 30, 0.2);
  border-radius: 50%;
}

.star-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--pine);
  letter-spacing: 2px;
}

/* Star element colors */
.star-circle.water { border-color: #1B4B7A; background: rgba(27, 75, 122, 0.05); }
.star-circle.water .star-name { color: #1B4B7A; }

.star-circle.earth { border-color: #6B4226; background: rgba(107, 66, 38, 0.05); }
.star-circle.earth .star-name { color: #6B4226; }

.star-circle.wood { border-color: var(--pine); background: rgba(44, 74, 30, 0.05); }
.star-circle.wood .star-name { color: var(--pine); }

.star-circle.metal { border-color: var(--gold); background: rgba(139, 105, 20, 0.05); }
.star-circle.metal .star-name { color: var(--gold); }

.star-circle.fire { border-color: var(--vermillion); background: rgba(179, 59, 36, 0.05); }
.star-circle.fire .star-name { color: var(--vermillion); }

.kyusei-element {
  font-size: 14px;
  color: var(--wood-mid);
  letter-spacing: 2px;
  margin-bottom: 20px;
}

.kyusei-fortune {
  background: rgba(245, 240, 232, 0.6);
  border-left: 3px solid var(--pine);
  border-right: 3px solid var(--pine);
  padding: 20px 24px;
  margin: 0 auto;
  max-width: 400px;
  font-size: 14px;
  line-height: 2;
  color: var(--ink);
  text-align: left;
}

/* --- Shaking animation for omikuji box --- */
@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  10% { transform: translateX(-4px) rotate(-2deg); }
  20% { transform: translateX(4px) rotate(2deg); }
  30% { transform: translateX(-4px) rotate(-1deg); }
  40% { transform: translateX(4px) rotate(1deg); }
  50% { transform: translateX(-2px) rotate(-1deg); }
  60% { transform: translateX(2px) rotate(1deg); }
  70% { transform: translateX(-1px) rotate(0deg); }
  80% { transform: translateX(1px) rotate(0deg); }
}

.omikuji-box.shaking {
  animation: shake 0.8s ease-in-out;
}

/* --- Fade-in animation --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.8s ease forwards;
}

/* --- Stamp pop animation --- */
@keyframes stampPop {
  0% { transform: rotate(-5deg) scale(2); opacity: 0; }
  60% { transform: rotate(-5deg) scale(0.95); opacity: 1; }
  100% { transform: rotate(-5deg) scale(1); opacity: 1; }
}

.stamp-animate {
  animation: stampPop 0.5s ease forwards;
}

/* --- Footer --- */
.shrine-footer {
  text-align: center;
  padding-top: 20px;
}

.footer-text {
  font-size: 12px;
  color: var(--sand);
  letter-spacing: 2px;
  line-height: 2;
  margin: 8px 0;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .container {
    padding: 28px 16px 40px;
  }

  .main-title {
    font-size: 28px;
    letter-spacing: 12px;
    text-indent: 12px;
  }

  .section-title {
    font-size: 24px;
    letter-spacing: 8px;
    text-indent: 8px;
  }

  .result-stamp {
    width: 100px;
    height: 100px;
  }

  .stamp-text {
    font-size: 28px;
  }

  .star-circle {
    width: 120px;
    height: 120px;
  }

  .star-name {
    font-size: 18px;
  }
}
