/* ===================================
   リセット & 基本スタイル
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html, canvas {
    width: 100%;
    height: 100%;
    position: relative;
    margin: 0;
    padding: 0;
    background: transparent;
}

body {
    font-family: 'M PLUS Rounded 1c', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    font-weight: 700;
    color: #fff;
    overflow-x: hidden;
}

/* 背景画像 + ブラー */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 現代のブラウザは95%以上がWebPに対応しているため、WebPを使用 */
    background: url('images/background.webp') center/cover no-repeat;
    filter: blur(3px);
    z-index: -2;
    /* 画像がない場合のフォールバック */
    background-color: #1a1a1a;
}

/* ラジアルグラデーションオーバーレイ */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at 50% 40%,
        transparent 60%,
        rgba(255, 255, 255, 0.13)
    );
    z-index: -1;
}

/* ===================================
   Canvas背景
   =================================== */
#bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    filter: blur(2px);
}

/* ===================================
   ローディング画面
   =================================== */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 17, 17, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 20px;
    font-size: 1.2rem;
    animation: blink 1.5s steps(2, start) infinite;
}

/* ===================================
   メインコンテンツ
   =================================== */
#content {
    display: none;
    position: relative;
    z-index: 1;
}

.container {
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

/* ===================================
   プロフィールセクション
   =================================== */
.profile-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.profile-img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
    background-color: #222;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.profile-section:hover .profile-img {
    transform: scale(1.05);
}

.profile-name {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 吹き出し */
.speech-bubble {
    position: absolute;
    top: -70px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background-color: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 0.8rem 1.2rem;
    border-radius: 1rem;
    font-size: 0.95rem;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10;
    pointer-events: none;
}

.speech-bubble::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(255, 255, 255, 0.95);
}

.speech-bubble p {
    margin: 0;
    font-weight: 700;
    user-select: none;
    caret-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.profile-section:hover .speech-bubble,
.profile-section.active .speech-bubble {
    transform: translateX(-50%) scale(1);
    opacity: 1;
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% {
        transform: translateX(-50%) scale(1) translateY(0);
    }
    50% {
        transform: translateX(-50%) scale(1) translateY(-5px);
    }
}

/* ===================================
   ソーシャルリンク
   =================================== */
.social-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.social-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.social-link:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.social-link i {
    font-size: 1.5rem;
    width: 30px;
    text-align: center;
}

/* ===================================
   フッター
   =================================== */
.footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.7;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ===================================
   アニメーション
   =================================== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    25%, 75% {
        opacity: 0.2;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#content.show {
    animation: fadeIn 0.7s ease;
}

/* ===================================
   レスポンシブデザイン
   =================================== */
@media (max-width: 768px) {
    .container {
        padding: 2rem 1.5rem;
    }

    .profile-section {
        margin-top: 80px;
    }

    .speech-bubble {
        font-size: 0.9rem;
        padding: 0.7rem 1rem;
        top: -65px;
    }

    .social-links {
        max-width: 350px;
    }

    .social-link {
        padding: 0.9rem 1.2rem;
        font-size: 1rem;
    }

    .social-link i {
        font-size: 1.3rem;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 2rem 1rem;
        min-height: 0;
    }

    .profile-section {
        margin-top: 90px;
    }

    .speech-bubble {
        font-size: 0.85rem;
        padding: 0.6rem 0.9rem;
        top: -60px;
    }

    .social-links {
        max-width: 100%;
        gap: 0.8rem;
    }

    .social-link {
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }

    .social-link i {
        font-size: 1.2rem;
        width: 25px;
    }

    .footer {
        font-size: 0.8rem;
        margin-top: 1.5rem;
    }
}

@media (max-width: 400px) {
    .profile-section {
        margin-top: 80px;
    }

    .speech-bubble {
        font-size: 0.8rem;
        padding: 0.5rem 0.8rem;
        top: -55px;
    }

    .social-link {
        padding: 0.7rem 0.8rem;
        font-size: 0.9rem;
        gap: 0.8rem;
    }
}
