footer {
    /* background-color: #ffffff; */
    /* box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1); */
    padding: 0.02rem 0;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: bottom 0.3s ease;
    /* height: 60px; */
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
}

/* Google AdSense用のスペース */
footer.has-ads {
    bottom: 60px;
}

/* フッターメニューボタン */
.footer-menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    background-color: #f9fafb;
    color: #9ca3af;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto;
    margin-right: 0.7em;
    margin-bottom: 2.5em;
    box-shadow: 0 1px 3px rgba(156, 163, 175, 0.15);
    position: relative;
    z-index: 1001;
    /* デバッグ用: ボタンの位置を確認 */
    /* background-color: blue !important; */
}

/* 通知ベルボタン */
.footer-notification-button {
    display: none;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    background-color: #f9fafb;
    color: #9ca3af;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: auto;
    margin-left: 0.7em;
    margin-bottom: 2.5em;
    box-shadow: 0 1px 3px rgba(156, 163, 175, 0.15);
    position: relative;
    z-index: 998;
}

.footer-notification-button:hover {
    background-color: #f3f4f6;
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(156, 163, 175, 0.2);
}

.footer-notification-button.active {
    background-color: #f3f4f6;
    box-shadow: 0 2px 6px rgba(156, 163, 175, 0.2);
}

/* ハンバーガーアイコン */
.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    gap: 0.06rem;
}

.hamburger-icon span {
    display: block;
    width: 0.6rem;
    height: 0.05rem;
    background-color: #9ca3af;
    border-radius: 0.02rem;
    transition: all 0.3s ease;
}

/* アクティブ時のハンバーガーアイコンのアニメーション */
.footer-menu-button.active .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(0.08rem, 0.08rem);
}

.footer-menu-button.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.footer-menu-button.active .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(0.08rem, -0.08rem);
}

/* ベルアイコン */
.bell-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #9ca3af;
    transition: all 0.3s ease;
}

.bell-icon svg {
    width: 0.7rem;
    height: 0.7rem;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* ホバー時のベルアイコンアニメーション */
.footer-notification-button:hover .bell-icon svg {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 1px 2px rgba(156, 163, 175, 0.3));
}

/* アクティブ時のベルアイコンアニメーション */
.footer-notification-button.active .bell-icon svg {
    transform: scale(0.95);
    animation: bellRing 0.3s ease-in-out;
}

/* ベルが鳴るアニメーション */
@keyframes bellRing {
    0% { transform: scale(0.95) rotate(0deg); }
    25% { transform: scale(1.05) rotate(-8deg); }
    50% { transform: scale(1.05) rotate(8deg); }
    75% { transform: scale(1.05) rotate(-4deg); }
    100% { transform: scale(0.95) rotate(0deg); }
}

/* 通知がある時のベルアイコン */
.footer-notification-button.has-notification .bell-icon svg {
    animation: bellPulse 2s infinite;
}

@keyframes bellPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 通知バッジ */
.notification-badge {
    position: absolute;
    top: -0.1rem;
    right: -0.1rem;
    width: 0.4rem;
    height: 0.4rem;
    background-color: #ef4444;
    border-radius: 50%;
    border: 1px solid #ffffff;
    display: none;
}

.notification-badge.show {
    display: block;
}

.footer-nav {
    position: fixed;
    bottom: 0.5rem;
    right: 0.2rem;
    left: 0.2rem;
    display: none;
    flex-direction: column;
    gap: 0.08rem;
    width: auto;
    margin: 0;
    padding: 0.5rem;
    height: auto;
    background-color: #ffffff;
    border: 1px solid #f0f0f0;
    border-radius: 0.75rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateX(8px);
    z-index: 1000;
    /* デバッグ用: 一時的に表示 */
    /* display: flex !important; */
    /* background-color: red !important; */
}

/* 広告が表示される時のメニュー位置調整 */
footer.has-ads .footer-nav {
    bottom: calc(60px + 0.5rem);
}

/* 広告が表示される時の通知モーダル位置調整 */
footer.has-ads .notification-modal {
    bottom: calc(60px + 2.0rem);
}

.footer-nav.show {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
}

.footer-nav-row {
    display: flex;
    gap: 0.08rem;
    width: 100%;
}

.footer-nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #666;
    transition: all 0.3s ease;
    padding: 0.12rem 0.06rem;
    gap: 0.06rem;
    border-radius: 0.06rem;
    min-height: 1.2rem;
    flex: 1;
    text-align: center;
    box-sizing: border-box;
    min-width: 0;
}

/* 1行目（最初の3つのアイテム） */
.footer-nav-item:nth-child(-n+3) {
    order: 1;
}

/* 2行目（残りの3つのアイテム） */
.footer-nav-item:nth-child(n+4) {
    order: 2;
}

.footer-nav-item:hover,
.footer-nav-item:focus {
    color: #f87171;
    background-color: #fef2f2;
    outline: none;
}

.footer-nav-item i {
    font-size: 0.55rem;
    width: 0.6rem;
    text-align: center;
    flex-shrink: 0;
}

.footer-nav-item span {
    font-size: 0.5rem;
    white-space: nowrap;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}


#ad-block {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    height: 60px;
    z-index: 999;
    transition: all 0.3s ease;
    display: none;
    justify-content: center;
    align-items: center;
}

#ad-block.visible {
    display: flex;
}

#google-ad {
    min-width: 300px;
    max-width: 500px;
    width: auto;
    text-align: center;
}

/* タブレット以上のサイズ */
@media (min-width: 768px) {
    footer {
        padding: 0.1rem 0.3rem;
        height: auto;
        min-height: 70px;
    }

    .footer-menu-button {
        width: 1.2rem;
        height: 1.2rem;
        margin-right: 0.5rem;
    }

    .footer-notification-button {
        width: 1.2rem;
        height: 1.2rem;
        margin-left: 0.5rem;
    }

    .bell-icon svg {
        width: 0.65rem;
        height: 0.65rem;
    }

    .hamburger-icon span {
        width: 0.6rem;
        height: 0.05rem;
    }

    /* 通知モーダルの位置調整（タブレット以上） */
    .notification-modal {
        left: 1.8rem;
        width: 20rem;
    }

    .notification-modal::before {
        bottom: 0.8rem;
        left: -0.5rem;
    }

    .notification-modal::after {
        bottom: 0.8rem;
        left: -0.6rem;
    }

    /* アクティブ時のハンバーガーアイコンのアニメーション（タブレット以上） */
    .footer-menu-button.active .hamburger-icon span:nth-child(1) {
        transform: rotate(45deg) translate(0.08rem, 0.08rem);
    }

    .footer-menu-button.active .hamburger-icon span:nth-child(3) {
        transform: rotate(-45deg) translate(0.08rem, -0.08rem);
    }

    .footer-nav {
        gap: 0.12rem;
        padding: 0.2rem;
        right: 1rem;
        left: 1rem;
    }

    .footer-nav-item {
        padding: 0.15rem 0.08rem;
        gap: 0.08rem;
        min-height: 1.4rem;
        min-width: 0;
    }

    .footer-nav-item i {
        font-size: 0.65rem;
        width: 0.7rem;
    }

    .footer-nav-item span {
        font-size: 0.6rem;
    }
}

/* デスクトップ以上のサイズ */
@media (min-width: 1024px) {
    .footer-notification-button {
        width: 1.3rem;
        height: 1.3rem;
    }

    .bell-icon svg {
        width: 0.7rem;
        height: 0.7rem;
    }

    /* 通知モーダルの位置調整（デスクトップ以上） */
    .notification-modal {
        left: 2.2rem;
        width: 22rem;
    }

    .notification-modal::before {
        bottom: 0.8rem;
        left: -0.5rem;
    }

    .notification-modal::after {
        bottom: 0.8rem;
        left: -0.6rem;
    }

    .footer-nav {
        right: 2rem;
        left: 2rem;
    }
    
    .footer-nav-item {
        min-width: 0;
        min-height: 1.6rem;
    }
    
    .footer-nav-item i {
        font-size: 0.7rem;
        width: 0.8rem;
    }
    
    .footer-nav-item span {
        font-size: 0.65rem;
    }

    /* デスクトップ向けのバツマーク調整 */
    .footer-menu-button.active .hamburger-icon span:nth-child(1) {
        transform: rotate(45deg) translate(0.08rem, 0.08rem);
    }

    .footer-menu-button.active .hamburger-icon span:nth-child(3) {
        transform: rotate(-45deg) translate(0.08rem, -0.08rem);
    }
}

/* ハンバーガーメニューボタンのホバーとアクティブ状態 */
.footer-menu-button:hover {
    background-color: #f3f4f6;
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(156, 163, 175, 0.2);
}

.footer-menu-button.active {
    background-color: #f3f4f6;
    box-shadow: 0 2px 6px rgba(156, 163, 175, 0.2);
}