html[lang="ja"] {
    font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    overflow: hidden; /* 図形が画面外に出たときにスクロールバーが出ないように */
    position: relative;
    z-index: 0; /* iOS等で背景が隠れないようにスタッキングコンテキストを作成 */
    cursor: none; /* デフォルトカーソルを非表示 */
}

/* iOS対応: 背景を独立した固定レイヤーにする */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* WebKitプレフィックスを追加 */
    background: -webkit-linear-gradient(-45deg, #FF8008, #FFC837, #FC466B, #3F5EFB);
    background: linear-gradient(-45deg, #FF8008, #FFC837, #FC466B, #3F5EFB);
    background-size: 600% 600%;
    animation: gradientBG 25s ease infinite;
    z-index: -2; /* 図形よりさらに後ろ */
    will-change: background-position; /* アニメーション最適化 */
}

/* カスタムカーソル */
.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: white;
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    transition: width 0.2s, height 0.2s, background-color 0.2s, transform 0.1s;
}

/* リンクホバー時のカーソル変化 */
body.hovering .cursor-outline {
    width: 70px;
    height: 70px;
    background-color: rgba(255, 255, 255, 0.2);
    border-color: transparent;
}

a {
    cursor: none; /* リンク上でもカーソル非表示 */
}

/* 背景の図形アニメーション */
.background-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1; /* 文字より後ろに配置 */
    margin: 0;
    padding: 0;
    list-style: none;
}

.background-shapes li {
    position: absolute;
    display: block;
    list-style: none;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    animation: animateShapes 25s linear infinite;
    bottom: -150px;
    border-radius: 4px; /* 少し角を丸く */
}

.background-shapes li:nth-child(1) {
    left: 25%;
    width: 80px;
    height: 80px;
    animation-delay: 0s;
}

.background-shapes li:nth-child(2) {
    left: 10%;
    width: 20px;
    height: 20px;
    animation-delay: 2s;
    animation-duration: 12s;
}

.background-shapes li:nth-child(3) {
    left: 70%;
    width: 20px;
    height: 20px;
    animation-delay: 4s;
}

.background-shapes li:nth-child(4) {
    left: 40%;
    width: 60px;
    height: 60px;
    animation-delay: 0s;
    animation-duration: 18s;
}

.background-shapes li:nth-child(5) {
    left: 65%;
    width: 20px;
    height: 20px;
    animation-delay: 0s;
}

.background-shapes li:nth-child(6) {
    left: 75%;
    width: 110px;
    height: 110px;
    animation-delay: 3s;
}

.background-shapes li:nth-child(7) {
    left: 35%;
    width: 150px;
    height: 150px;
    animation-delay: 7s;
}

.background-shapes li:nth-child(8) {
    left: 50%;
    width: 25px;
    height: 25px;
    animation-delay: 15s;
    animation-duration: 45s;
}

.background-shapes li:nth-child(9) {
    left: 20%;
    width: 15px;
    height: 15px;
    animation-delay: 2s;
    animation-duration: 35s;
}

.background-shapes li:nth-child(10) {
    left: 85%;
    width: 150px;
    height: 150px;
    animation-delay: 0s;
    animation-duration: 11s;
}

@keyframes animateShapes {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
        border-radius: 0;
    }
    100% {
        transform: translateY(-1000px) rotate(720deg);
        opacity: 0;
        border-radius: 50%;
    }
}

h1 {
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 2rem;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.letter {
    display: inline-block;
    opacity: 0;
    /* 登場アニメーションの後に、浮遊アニメーションを追加 */
    animation: 
        jumpRotate 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards,
        float 4s ease-in-out infinite;
    will-change: transform, opacity; /* レンダリング最適化 */
}

/* 1つ目の値はjumpRotate用、2つ目の値はfloat用（着地後すぐに開始） */
.letter:nth-child(1) { animation-delay: 0.1s, 1.6s; }
.letter:nth-child(2) { animation-delay: 0.2s, 1.7s; }
.letter:nth-child(3) { animation-delay: 0.3s, 1.8s; }
.letter:nth-child(4) { animation-delay: 0.4s, 1.9s; }
.letter:nth-child(5) { animation-delay: 0.5s, 2.0s; }
.letter:nth-child(6) { animation-delay: 0.6s, 2.1s; }
.letter:nth-child(7) { animation-delay: 0.7s, 2.2s; }
.letter:nth-child(8) { animation-delay: 0.8s, 2.3s; }
.letter:nth-child(9) { animation-delay: 0.9s, 2.4s; }
.letter:nth-child(10) { animation-delay: 1.0s, 2.5s; }
.letter:nth-child(11) { animation-delay: 1.1s, 2.6s; }
.letter:nth-child(12) { animation-delay: 1.2s, 2.7s; }

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0) scale(1);
    }
    50% {
        transform: translateY(-12px) rotate(0) scale(1);
    }
}

@keyframes jumpRotate {
    0% {
        opacity: 0;
        transform: translateY(50px) rotate(90deg) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateY(-20px) rotate(-20deg) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(0) scale(1);
    }
}

a {
    display: inline-block;
    padding: 0.5rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    position: relative;
    transition: all 0.3s ease;
    
    /* アニメーション: h1より少し遅れて登場 */
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.4s forwards;
}

/* ホバー時の下線アニメーション */
a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: 5px;
    left: 50%;
    background-color: white;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

a:hover {
    color: white;
    transform: translateY(-2px);
}

a:hover::after {
    width: 80%;
}

/* フェードイン + 上昇のアニメーション定義 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 背景グラデーションのアニメーション: 不規則な軌道でランダム感を出す */
@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }
    20% {
        background-position: 100% 20%;
    }
    40% {
        background-position: 20% 100%;
    }
    60% {
        background-position: 80% 0%;
    }
    80% {
        background-position: 0% 80%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem; /* スマホでは文字サイズを小さく */
        margin-bottom: 1.5rem;
        padding: 0 1rem; /* 横幅に余裕を持たせる */
    }

    /* スマホではカーソルエフェクトを無効化（タッチ操作のため） */
    .cursor-dot,
    .cursor-outline {
        display: none;
    }

    body, a {
        cursor: auto; /* デフォルトのカーソルに戻す */
    }
}