/* ========================================
   Co-lingo ハンバーガーメニュー - 小さく可愛いサイズ版
   ======================================== */

/* wrapperを相対配置の基準にする */
.wrapper {
    position: relative;
}

/* スマホ時の背景サイズを固定 */
@media (max-width: 767px) {
    .wrapper {
        max-width: 100%;
        width: 100%;
        margin: 0 auto;
    }
}

/* パソコン時の背景サイズを固定 (1980x1080相当) */
@media (min-width: 1024px) {
    .wrapper {
        max-width: 660px;
        /* 1980pxの1/3スケール */
        margin: 0 auto;
    }
}

/* メニューラッパー */
.colingo-menu-wrapper {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 9999;
}

/* 色選択ページの色リンゴがメニューボタンを覆わないように */
.page-colorselect .color-list {
    position: relative;
    z-index: 1;
}

.page-colorselect .color-link,
.page-colorselect .color-link img {
    position: relative;
    z-index: 1;
}

/* メニューボタンの領域を確実にクリック可能に */
.page-colorselect .colingo-menu-wrapper {
    z-index: 99999 !important;
}

.page-colorselect .apple-menu-button {
    z-index: 100000 !important;
    pointer-events: auto !important;
}

/* リンゴキャラクター（メニューボタン） - スマホ（デフォルト） */
.apple-menu-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    cursor: pointer;
    z-index: 99999;
    /* 色選択ページのリンゴ画像より高く */
    transition: transform 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.apple-menu-button:active {
    transform: scale(0.95);
}

.apple-character {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: gentle-bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.12));
}

/* ぴょんぴょんアニメーション */
@keyframes gentle-bounce {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-8px) rotate(-3deg);
    }

    50% {
        transform: translateY(0) rotate(0deg);
    }

    75% {
        transform: translateY(-4px) rotate(3deg);
    }
}

/* メニューパネル - スマホ（デフォルト） */
.menu-panel {
    position: absolute;
    top: 55px;
    right: 8px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    padding: 10px;
    min-width: 110px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10000;
    border: 1px solid #f0f0f0;
}

.menu-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 閉じるボタン */
.menu-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.menu-close:active {
    color: #333;
    transform: rotate(90deg);
}

/* メニューナビゲーション */
.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 25px;
}

/* メニューアイテム */
.menu-item {
    display: block;
    padding: 10px 14px;
    text-decoration: none;
    color: #333;
    border-radius: 7px;
    transition: all 0.3s ease;
    background: #f8f8f8;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.menu-item:active {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
    color: #ffffff;
    transform: scale(0.98);
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
}

/* メニューアイテムのアニメーション */
.menu-panel.active .menu-item {
    animation: slideInMenu 0.4s ease forwards;
    opacity: 0;
}

.menu-panel.active .menu-item:nth-child(1) {
    animation-delay: 0.1s;
}

.menu-panel.active .menu-item:nth-child(2) {
    animation-delay: 0.2s;
}

.menu-panel.active .menu-item:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes slideInMenu {
    from {
        opacity: 0;
        transform: translateX(15px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   タブレット（768px以上）
   ======================================== */
@media (min-width: 768px) {
    .apple-menu-button {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .menu-panel {
        top: 62px;
        right: 10px;
        min-width: 120px;
        padding: 12px;
    }

    .menu-item {
        padding: 10px 16px;
        font-size: 15px;
    }

    .menu-close {
        width: 22px;
        height: 22px;
        font-size: 20px;
    }
}

/* ========================================
   パソコン（1024px以上）
   ======================================== */
@media (min-width: 1024px) {
    .apple-menu-button {
        top: 12px;
        right: 12px;
        width: 45px;
        height: 45px;
    }

    /* ホバーエフェクトを有効化 */
    .apple-menu-button:hover {
        transform: scale(1.15);
    }

    .apple-menu-button:active {
        transform: scale(1.05);
    }

    .menu-panel {
        top: 70px;
        right: 12px;
        min-width: 130px;
        padding: 14px;
        border-radius: 12px;
    }

    .menu-item {
        padding: 11px 18px;
        font-size: 15px;
        border-radius: 8px;
    }

    /* デスクトップではホバーエフェクトを有効化 */
    .menu-item:hover {
        background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
        color: #ffffff;
        transform: translateX(-3px);
        box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
    }

    .menu-item:active {
        transform: translateX(-3px) scale(0.98);
    }

    .menu-close {
        width: 24px;
        height: 24px;
        font-size: 22px;
    }

    .menu-close:hover {
        color: #333;
        transform: rotate(90deg);
    }

    .menu-close:active {
        transform: rotate(90deg) scale(0.95);
    }
}

/* ========================================
   大画面（1440px以上）
   ======================================== */
@media (min-width: 1440px) {
    .apple-menu-button {
        top: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
    }

    .menu-panel {
        top: 78px;
        right: 15px;
        min-width: 140px;
        padding: 16px;
    }

    .menu-item {
        padding: 12px 20px;
        font-size: 16px;
    }
}