@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Noto+Serif+JP:wght@200;400;700&display=swap');

:root {
    --mystic-purple: #4b0082;
    --cosmic-blue: #1a237e;
    --stardust: #e0e0ff;
    --cosmic-glow: #9c27b0;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Noto Serif JP', 'Cinzel', serif;
    background: linear-gradient(135deg, #000000, #1a1a2e);
    color: var(--stardust);
    overflow: hidden;
    position: relative;
}

.cosmic-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(76, 0, 130, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(138, 43, 226, 0.2) 0%, transparent 50%);
    z-index: -2;
}

.energy-circle {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300vh;
    height: 300vh;
    border: 1px solid rgba(147, 112, 219, 0.1);
    border-radius: 50%;
    animation: rotateEnergy 60s linear infinite;
    z-index: -1;
}

.content {
    position: relative;
    z-index: 1;
    padding: 2rem;
    text-align: center;
    margin-top: 10vh;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(120deg, var(--stardust), var(--cosmic-glow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(156, 39, 176, 0.3);
    animation: titleGlow 3s ease-in-out infinite;
}

.mystic-button {
    position: relative;
    padding: 1.2rem 3rem;
    font-size: 1.2rem;
    background: linear-gradient(45deg, var(--mystic-purple), var(--cosmic-blue));
    color: var(--stardust);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    animation: buttonPulse 2s infinite;
}

.result {
    margin-top: 2rem;
    font-size: 1.5rem;
    color: var(--stardust);
    opacity: 1;
    transition: all 0.5s ease;
}

/* 五芒星アニメーション */
.pentagram-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    z-index: 0;
}

.pentagram {
    width: 100%;
    height: 100%;
    position: relative;
    animation: drawPentagram 5s linear infinite;
    aspect-ratio: 1 / 1; /* 縦横比を1:1に固定 */
}



.pentagram path {
    fill: none;
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 2;
    stroke-dasharray: 150;
    stroke-dashoffset: 150;
    animation: drawLine 2s ease forwards, drawLineAgain 5s ease infinite 5s;
}

/* 各線の遅延開始 */
.pentagram path:nth-child(1) { animation-delay: 0s, 5s; }
.pentagram path:nth-child(2) { animation-delay: 0s, 5s; }
.pentagram path:nth-child(3) { animation-delay: 0s, 5s; }
.pentagram path:nth-child(4) { animation-delay: 0s, 5s; }
.pentagram path:nth-child(5) { animation-delay: 0s, 5s; }

/* 初回描画 */
@keyframes drawLine {
    0% {
        stroke-dashoffset: 150;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* 二度目の描画 */
@keyframes drawLineAgain {
    0% {
        stroke-dashoffset: 150;
    }
    20% {
        stroke-dashoffset: 150;
    }
    45% {
        stroke-dashoffset: 0;
    }
    75% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: 150;
    }
}



/* オーブアニメーション */
.orb {
    position: absolute;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, var(--stardust) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(1px);
    animation: floatOrb 15s ease-in-out infinite;
}

/* エネルギーライン */
.energy-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--stardust), transparent);
    filter: blur(1px);
    animation: flowEnergy 8s linear infinite;
}

/* アニメーションキーフレーム */
@keyframes drawPentagram {
    0% { transform: scale(0.1) rotate(0deg); opacity: 0; }
    20% { transform: scale(1) rotate(72deg); opacity: 1; }
    40% { transform: scale(1) rotate(144deg); opacity: 1; }
    60% { transform: scale(1) rotate(216deg); opacity: 1; }
    80% { transform: scale(1) rotate(288deg); opacity: 1; }
    90% { transform: scale(2) rotate(360deg); opacity: 0.5; }
    100% { transform: scale(3) rotate(360deg); opacity: 0; }
}

@keyframes pentagramGlow {
    0% { box-shadow: 0 0 10px var(--stardust); }
    50% { box-shadow: 0 0 30px var(--stardust), 0 0 50px var(--cosmic-glow); }
    100% { box-shadow: 0 0 10px var(--stardust); }
}

@keyframes floatOrb {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(100px, -100px); }
    50% { transform: translate(200px, 0); }
    75% { transform: translate(100px, 100px); }
}

@keyframes flowEnergy {
    0% { transform: translateX(-100%) translateY(0); }
    100% { transform: translateX(100%) translateY(-50px); }
}

@keyframes rotateEnergy {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    h1 { font-size: 1.8rem; }
    .pentagram-container { width: 150px; height: 150px; }
    .mystic-button { padding: 1rem 2rem; font-size: 1rem; }
}

@media (max-width: 480px) {
    h1 { font-size: 1.5rem; }
    .pentagram-container { width: 100px; height: 100px; }
    .content { margin-top: 5vh; }
    .mystic-button { padding: 0.8rem 1.6rem; }
}
@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}