/* =========================================================================
 * ページトップ／上へ戻るボタン (STAGEテーマ最適化・リッチフェード仕様)
 * ========================================================================= */
.pagetop-btn {
    position: fixed;
    width: 75px;
    height: 75px;
    border: solid 2px rgb(255, 208, 0);
    border-radius: 50%;
    background: #000000;
    cursor: pointer;
    right: 25px;
    bottom: 25px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(100px);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(255, 208, 0, 0.2);
    overflow: hidden;
}

/* 内部コンテンツのラッパー */
.pagetop-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px; /* 矢印と文字の隙間 */
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* 矢印アイコン */
.pagetop-arrow {
    width: 10px;
    height: 10px;
    border-left: 2px solid rgb(255, 208, 0);
    border-top: 2px solid rgb(255, 208, 0);
    transform: rotate(45deg);
    margin-top: 2px;
    transition: border-color 0.4s ease;
}

/* テキスト */
.pagetop-text {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.5px;
    color: rgb(255, 208, 0);
    transition: color 0.4s ease;
}

/* --- モード別の初期状態 --- */
/* 通常モードのコンテンツ */
.content-top {
    opacity: 1;
    transform: translateY(0);
}

/* 戻るモードのコンテンツ */
.content-return {
    opacity: 0;
    transform: translateY(15px); /* 少し下からスライドインさせる */
}

.content-return .pagetop-arrow {
    border-left-color: #000000;
    border-top-color: #000000;
}

.content-return .pagetop-text {
    color: #000000;
}

/* --- 表示時・ホバー時の挙動 --- */
.pagetop-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.pagetop-btn:hover {
    background: #1a1a1a;
    box-shadow: 0 6px 20px rgba(255, 208, 0, 0.35);
    transform: translateY(-2px);
}

/* =========================================================================
 * 戻るモード「上へ戻る」時の劇的な変化 (背景との調黄調和を維持)
 * ========================================================================= */
.pagetop-btn.return-mode {
    background: rgb(255, 208, 0); /* 背景をテーマカラーの黄色で塗りつぶし */
    border-color: rgb(255, 208, 0);
    box-shadow: 0 4px 15px rgba(255, 208, 0, 0.4);
}

/* コンテンツの切り替えアニメーション */
.pagetop-btn.return-mode .content-top {
    opacity: 0;
    transform: translateY(-15px); /* 上へスライドアウト */
}

.pagetop-btn.return-mode .content-return {
    opacity: 1;
    transform: translateY(0); /* 定位置へスライドイン */
}

/* 戻るモード時のホバー */
.pagetop-btn.return-mode:hover {
    background: #e6bb00; /* 少し濃い黄色へ */
    border-color: #e6bb00;
    box-shadow: 0 6px 20px rgba(255, 208, 0, 0.5);
    transform: translateY(-2px);
}

/* レスポンシブ対応 */
@media screen and (max-width: 767px) {
    .pagetop-btn {
        width: 65px;
        height: 65px;
        right: 15px;
        bottom: 15px;
    }
    .pagetop-text {
        font-size: 10px;
    }
    .pagetop-arrow {
        width: 8px;
        height: 8px;
    }
}
