@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@300;400;600;700&family=Zen+Antique&family=Shippori+Mincho:wght@400;600;800&display=swap');

/* ===== CSS Variables & Themes ===== */
:root {
  --transition: 0.4s ease;
}

/* Theme 1: 牡丹ピンク */
body.theme-0 {
  --bg-primary: #f9e8ef;
  --bg-secondary: #fdf0f5;
  --accent: #c0607a;
  --accent-light: #e8a0b4;
  --accent-dark: #8b3a52;
  --text-main: #4a2030;
  --text-sub: #8b5a6a;
  --card-bg: rgba(255, 245, 250, 0.92);
  --border: #e8b4c8;
  --gold: #c9956a;
  --btn-text: #fff;
  --shadow: rgba(192, 96, 122, 0.25);
  --orb1: #f7c5d5;
  --orb2: #e8a0b4;
  --orb3: #fde8f0;
  --pattern-color: rgba(192, 96, 122, 0.07);
}

/* Theme 2: 藤紫 */
body.theme-1 {
  --bg-primary: #ede8f5;
  --bg-secondary: #f5f0fb;
  --accent: #7b5ea7;
  --accent-light: #b09ccc;
  --accent-dark: #4e3575;
  --text-main: #2d1f4a;
  --text-sub: #6a508a;
  --card-bg: rgba(248, 245, 255, 0.92);
  --border: #c4b0e0;
  --gold: #c9956a;
  --btn-text: #fff;
  --shadow: rgba(123, 94, 167, 0.25);
  --orb1: #d8cff0;
  --orb2: #b09ccc;
  --orb3: #ede8f5;
  --pattern-color: rgba(123, 94, 167, 0.07);
}

/* Theme 3: 翡翠グリーン */
body.theme-2 {
  --bg-primary: #e8f3ef;
  --bg-secondary: #f0f9f5;
  --accent: #4a8c72;
  --accent-light: #85c4a8;
  --accent-dark: #2d604e;
  --text-main: #1a3d30;
  --text-sub: #4a7060;
  --card-bg: rgba(242, 252, 248, 0.92);
  --border: #a0ccba;
  --gold: #c9956a;
  --btn-text: #fff;
  --shadow: rgba(74, 140, 114, 0.25);
  --orb1: #c5e0d5;
  --orb2: #85c4a8;
  --orb3: #e8f3ef;
  --pattern-color: rgba(74, 140, 114, 0.07);
}

/* Theme 4: 珊瑚オレンジ */
body.theme-3 {
  --bg-primary: #faf0ea;
  --bg-secondary: #fdf6f0;
  --accent: #c47a4a;
  --accent-light: #e0a878;
  --accent-dark: #8a4e2a;
  --text-main: #3d2010;
  --text-sub: #8a5a38;
  --card-bg: rgba(255, 250, 245, 0.92);
  --border: #e0c0a0;
  --gold: #c9956a;
  --btn-text: #fff;
  --shadow: rgba(196, 122, 74, 0.25);
  --orb1: #f0d5b8;
  --orb2: #e0a878;
  --orb3: #faf0ea;
  --pattern-color: rgba(196, 122, 74, 0.07);
}

/* Theme 5: 瑠璃ネイビー */
body.theme-4 {
  --bg-primary: #e8eef8;
  --bg-secondary: #f0f4fc;
  --accent: #3a5ea0;
  --accent-light: #7899cc;
  --accent-dark: #1e3870;
  --text-main: #0f1f40;
  --text-sub: #3a5080;
  --card-bg: rgba(240, 245, 255, 0.92);
  --border: #a0b8e0;
  --gold: #c9956a;
  --btn-text: #fff;
  --shadow: rgba(58, 94, 160, 0.25);
  --orb1: #c0d0f0;
  --orb2: #7899cc;
  --orb3: #e8eef8;
  --pattern-color: rgba(58, 94, 160, 0.07);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Serif JP', serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.6s ease;
}

/* ===== Background Pattern ===== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, var(--orb1) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, var(--orb2) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, var(--orb3) 0%, transparent 60%);
  z-index: 0;
  pointer-events: none;
}

/* 和柄パターン */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c0607a' fill-opacity='0.06'%3E%3Cpath d='M30 0 L60 30 L30 60 L0 30 Z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

/* ===== Floating Particles ===== */
.particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-light);
  opacity: 0;
  animation: float-particle linear infinite;
}

.particle:nth-child(1)  { left: 10%; animation-duration: 12s; animation-delay: 0s;    width: 4px; height: 4px; }
.particle:nth-child(2)  { left: 20%; animation-duration: 15s; animation-delay: 2s;    width: 6px; height: 6px; }
.particle:nth-child(3)  { left: 35%; animation-duration: 10s; animation-delay: 4s;    width: 3px; height: 3px; }
.particle:nth-child(4)  { left: 50%; animation-duration: 14s; animation-delay: 1s;    width: 5px; height: 5px; }
.particle:nth-child(5)  { left: 65%; animation-duration: 11s; animation-delay: 3s;    width: 4px; height: 4px; }
.particle:nth-child(6)  { left: 78%; animation-duration: 16s; animation-delay: 5s;    width: 6px; height: 6px; }
.particle:nth-child(7)  { left: 88%; animation-duration: 13s; animation-delay: 0.5s;  width: 3px; height: 3px; }
.particle:nth-child(8)  { left: 42%; animation-duration: 17s; animation-delay: 6s;    width: 5px; height: 5px; }
.particle:nth-child(9)  { left: 55%; animation-duration: 9s;  animation-delay: 2.5s;  width: 4px; height: 4px; }
.particle:nth-child(10) { left: 72%; animation-duration: 18s; animation-delay: 7s;    width: 6px; height: 6px; }

@keyframes float-particle {
  0%   { bottom: -20px; opacity: 0; transform: translateX(0) rotate(0deg); }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.4; }
  100% { bottom: 110%; opacity: 0; transform: translateX(30px) rotate(360deg); }
}

/* ===== Intro Animation Overlay ===== */
#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  animation: intro-fade-out 0.6s ease 2.2s forwards;
}

@keyframes intro-fade-out {
  0%   { opacity: 1; pointer-events: all; }
  100% { opacity: 0; pointer-events: none; }
}

.intro-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.intro-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent-light);
  animation: spin-circle 1.8s ease-in-out forwards;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-circle::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-bottom-color: var(--accent);
  border-left-color: var(--accent-light);
  animation: spin-circle-inner 1.8s ease-in-out forwards reverse;
}

.intro-circle::after {
  content: '✦';
  font-size: 32px;
  color: var(--accent);
  animation: star-pulse 1.8s ease-in-out;
}

@keyframes spin-circle {
  0%   { transform: rotate(0deg) scale(0.5); opacity: 0; }
  30%  { opacity: 1; }
  80%  { transform: rotate(720deg) scale(1.1); }
  100% { transform: rotate(720deg) scale(1); }
}

@keyframes spin-circle-inner {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(-720deg); }
}

@keyframes star-pulse {
  0%   { transform: scale(0); opacity: 0; }
  50%  { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.intro-text {
  font-family: 'Zen Antique', serif;
  font-size: 2rem;
  color: var(--accent);
  letter-spacing: 0.5em;
  animation: text-reveal 1.8s ease forwards;
  opacity: 0;
}

@keyframes text-reveal {
  0%   { opacity: 0; letter-spacing: 1em; transform: translateY(10px); }
  40%  { opacity: 1; }
  100% { opacity: 1; letter-spacing: 0.5em; transform: translateY(0); }
}

.intro-sub {
  font-size: 0.85rem;
  color: var(--text-sub);
  letter-spacing: 0.3em;
  animation: sub-reveal 2s ease 0.5s forwards;
  opacity: 0;
}

@keyframes sub-reveal {
  0%   { opacity: 0; transform: translateY(5px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Petals */
.intro-petals {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.petal {
  position: absolute;
  font-size: 1.5rem;
  animation: petal-fall linear forwards;
  opacity: 0;
}

.petal:nth-child(1)  { left: 15%; animation-duration: 2s;   animation-delay: 0.2s; font-size: 1.2rem; }
.petal:nth-child(2)  { left: 30%; animation-duration: 2.5s; animation-delay: 0.5s; }
.petal:nth-child(3)  { left: 50%; animation-duration: 2.2s; animation-delay: 0.1s; font-size: 1rem; }
.petal:nth-child(4)  { left: 65%; animation-duration: 2.8s; animation-delay: 0.7s; }
.petal:nth-child(5)  { left: 80%; animation-duration: 2s;   animation-delay: 0.3s; font-size: 1.3rem; }
.petal:nth-child(6)  { left: 10%; animation-duration: 3s;   animation-delay: 0.8s; }
.petal:nth-child(7)  { left: 90%; animation-duration: 2.3s; animation-delay: 0.4s; }
.petal:nth-child(8)  { left: 45%; animation-duration: 2.6s; animation-delay: 1s;   font-size: 1.1rem; }

@keyframes petal-fall {
  0%   { top: -30px; opacity: 0; transform: rotate(0deg) translateX(0); }
  20%  { opacity: 0.8; }
  80%  { opacity: 0.6; }
  100% { top: 110%; opacity: 0; transform: rotate(360deg) translateX(40px); }
}

/* ===== Main Layout ===== */
#main-content {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 60px;
  opacity: 0;
  animation: main-appear 0.8s ease 2.4s forwards;
}

@keyframes main-appear {
  0%   { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ===== Header ===== */
.site-header {
  text-align: center;
  margin-bottom: 40px;
}

.header-ornament {
  font-size: 1.2rem;
  color: var(--gold);
  letter-spacing: 0.5em;
  display: block;
  margin-bottom: 8px;
  animation: ornament-glow 3s ease-in-out infinite alternate;
}

@keyframes ornament-glow {
  0%   { opacity: 0.6; }
  100% { opacity: 1; text-shadow: 0 0 12px var(--gold); }
}

.site-title {
  font-family: 'Zen Antique', serif;
  font-size: clamp(2rem, 6vw, 3.2rem);
  color: var(--accent-dark);
  letter-spacing: 0.3em;
  line-height: 1.2;
  text-shadow: 0 2px 8px var(--shadow);
}

.site-date {
  font-size: 0.85rem;
  color: var(--text-sub);
  letter-spacing: 0.25em;
  margin-top: 10px;
}

/* ===== Fortune Card ===== */
.fortune-card {
  width: 100%;
  max-width: 520px;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 24px;
  border: 1.5px solid var(--border);
  box-shadow:
    0 8px 40px var(--shadow),
    0 2px 8px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.7);
  padding: 44px 40px 40px;
  position: relative;
  overflow: hidden;
}

/* カードの装飾コーナー */
.fortune-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--accent-light), var(--gold), var(--accent-light), transparent);
}

.card-corner {
  position: absolute;
  font-size: 1.4rem;
  color: var(--accent-light);
  opacity: 0.4;
}
.card-corner.tl { top: 14px; left: 16px; }
.card-corner.tr { top: 14px; right: 16px; transform: scaleX(-1); }
.card-corner.bl { bottom: 14px; left: 16px; transform: scaleY(-1); }
.card-corner.br { bottom: 14px; right: 16px; transform: scale(-1); }

/* ===== Fortune Result ===== */
.fortune-result {
  text-align: center;
}

.fortune-label {
  font-size: 0.78rem;
  letter-spacing: 0.4em;
  color: var(--text-sub);
  display: block;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.fortune-rank {
  font-family: 'Zen Antique', serif;
  font-size: clamp(2.5rem, 8vw, 4rem);
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
  text-shadow: 0 2px 12px var(--shadow);
  animation: rank-appear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 2.8s both;
}

@keyframes rank-appear {
  0%   { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.fortune-stars {
  font-size: 1.4rem;
  color: var(--gold);
  letter-spacing: 0.2em;
  display: block;
  margin-bottom: 20px;
  animation: stars-appear 0.6s ease 3.1s both;
}

@keyframes stars-appear {
  0%   { opacity: 0; transform: translateY(-8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.divider-icon {
  font-size: 1rem;
  color: var(--gold);
}

.fortune-message {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text-main);
  text-align: left;
  margin-bottom: 24px;
  animation: msg-appear 0.7s ease 3.3s both;
}

@keyframes msg-appear {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ===== Lucky Grid: 恋愛運・仕事運・金運・健康運 ===== */
.lucky-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
  animation: grid-appear 0.7s ease 3.5s both;
}

@keyframes grid-appear {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.lucky-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lucky-item-label {
  font-size: 0.7rem;
  color: var(--text-sub);
  letter-spacing: 0.2em;
}

.lucky-item-value {
  font-family: 'Shippori Mincho', serif;
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 600;
}

/* ===== Advice Block ===== */
.advice-block {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
  border-left: 3px solid var(--accent-light);
  border-radius: 0 12px 12px 0;
  padding: 16px 20px;
  margin-bottom: 0;
  animation: advice-appear 0.7s ease 3.7s both;
}

@keyframes advice-appear {
  0%   { opacity: 0; transform: translateX(-10px); }
  100% { opacity: 1; transform: translateX(0); }
}

.advice-title {
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
}

.advice-text {
  font-size: 0.92rem;
  line-height: 1.8;
  color: var(--text-main);
}

/* ===== Section Blocks (Lucky Ad / Recommend) ===== */
.section-block {
  width: 100%;
  max-width: 520px;
  margin-top: 24px;
}

/* ===== Lucky Banner Ad エリア ===== */
#lucky-container .lucky-ad-area {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1.5px solid var(--border);
  box-shadow: 0 4px 20px var(--shadow);
  padding: 20px;
  text-align: center;
  overflow: hidden;
}

#lucky-container .lucky-ad-area .ad-label {
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  color: var(--text-sub);
  display: block;
  margin-bottom: 10px;
}

#lucky-container .lucky-ad-area .ad-banner {
  display: block;
  width: 300px;
  height: 250px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

#lucky-container .lucky-ad-area .ad-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== Recommend エリア ===== */
#recommend-container .recommend-area {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1.5px solid var(--border);
  box-shadow: 0 4px 20px var(--shadow);
  padding: 24px;
  text-align: center;
  overflow: hidden;
}

#recommend-container .recommend-title {
  font-family: 'Zen Antique', serif;
  font-size: 1.1rem;
  color: var(--accent-dark);
  letter-spacing: 0.25em;
  margin-bottom: 16px;
}

#recommend-container .full-img {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 16px;
}

#recommend-container .rounded-img {
  border-radius: 12px;
}

#recommend-container .btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border-radius: 50px;
  font-family: 'Noto Serif JP', serif;
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

#recommend-container .btn-main {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 4px 16px var(--shadow);
}

#recommend-container .btn-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow);
}

#recommend-container .btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent-light);
}

#recommend-container .btn-outline:hover {
  background: var(--bg-secondary);
  transform: translateY(-1px);
}

#recommend-container .mb-10 {
  margin-bottom: 10px;
}

/* ===== Footer ===== */
.site-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-sub);
  letter-spacing: 0.2em;
  opacity: 0.7;
}

/* ===== Responsive ===== */
@media (max-width: 540px) {
  .fortune-card {
    padding: 36px 24px 32px;
  }

  .lucky-grid {
    grid-template-columns: 1fr 1fr;
  }

  #lucky-container .lucky-ad-area .ad-banner {
    width: 100%;
    height: auto;
    aspect-ratio: 300 / 250;
  }
}

@media (max-width: 360px) {
  .lucky-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Re-render animation ===== */
.fortune-refresh .fortune-rank {
  animation: rank-refresh 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes rank-refresh {
  0%   { transform: scale(0.5) rotate(-5deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
