/* ========================================
   漢堡選單唯一樣式來源（全站共用）
   架構：menu 放進 #stage 內，繼承畫布 500x850 縮放
         ★ 寬高、位置使用 px 或 %
   ======================================== */

/* ========================================
   漢堡按鈕
   ======================================== */
.hamburger-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 42px;
    height: 42px;
    max-width: 40px;
    /* 40px → 40px */
    max-height: 40px;
    /* 40px → 40px */
    background-color: hsla(0, 60%, 36%, 0.5);
    backdrop-filter: blur(10px);
    /* 10px → 10px */
    border-radius: 10px;
    /* 10px → 10px */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    z-index: 30000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    /* 0.3/12px → 6/12px */
}

.hamburger-btn:hover {
    background-color: hsla(0, 60%, 36%, 0.8);
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.hamburger-btn:active {
    transform: scale(0.9);
}

/* 漢堡線條 */
.hamburger-line {
    width: 60%;
    height: 4px;
    /* 4px → 4px */
    background-color: hsl(50, 60%, 80%);
    border-radius: 6px;
    /* 6px → 6px */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 選單打開時的動畫 */
.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(12px) rotate(45deg) scaleX(1.5);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-12px) rotate(-45deg) scaleX(1.5);
}

/* ========================================
   選單面板（加寬為格狀版型）
   ======================================== */
.menu-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 500px;
    height: 850px;
    background: linear-gradient(135deg, rgba(93, 24, 24, 0.95), rgba(70, 18, 18, 0.95));
    backdrop-filter: blur(20px);
    /* 20px → 20px */
    padding: 60px 10px 20px 10px;
    /* 0.5/20px → 10/20px */
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
    z-index: 29990;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
    /* 0.5/30px → 10/30px */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(244, 228, 160, 0.3) transparent;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    will-change: scroll-position;
}

.menu-panel::-webkit-scrollbar {
    width: 10px;
    /* 10px → 10px */
}

.menu-panel::-webkit-scrollbar-track {
    background: transparent;
}

.menu-panel::-webkit-scrollbar-thumb {
    background: rgba(244, 228, 160, 0.3);
    border-radius: 4px;
    /* 4px → 4px */
}

.menu-panel.active {
    transform: translateX(0);
    visibility: visible;
}

/* ========================================
   格狀容器：4 欄，並排顯示
   ======================================== */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px 0;
    /* 20px → 20px */
    width: 100%;
}

/* ========================================
   每個選單格子：上圖下文
   ======================================== */
.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    /* 8px → 8px */
    padding: 6px;
    /* 6px → 6px */
    color: #f4e4a0;
    cursor: pointer;
    border-radius: 12px;
    /* 12px → 12px */
    transition: background-color 0.2s ease, transform 0.15s ease;
    position: relative;
    overflow: hidden;
    min-height: 130px;
    /* 130px → 130px */
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.12);
    transform: scale(1.04);
}

.menu-item:active {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(0.97);
}

/* 選單項目提示徽章（有可領獎狀或考試資格時） */
.menu-item-img-wrap { position: relative; }

.menu-item-img-wrap.menu-item-alert::after {
    content: "!";
    position: absolute;
    top: -6px;
    right: -6px;
    width: 26px;
    height: 26px;
    line-height: 22px;
    text-align: center;
    background: hsl(50, 100%, 55%);
    color: hsl(0, 85%, 45%);
    font-size: 20px;
    font-weight: 900;
    border-radius: 50%;
    border: 2px solid hsl(0, 85%, 45%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    animation: menu-item-alert-pulse 1.4s ease-in-out infinite;
    z-index: 5;
    pointer-events: none;
}

@keyframes menu-item-alert-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.18); }
}

/* 圖片外框（固定高度） */
.menu-item-img-wrap {
    width: 100%;
    height: 160px;
    /* 160px → 160px */
    border-radius: 8px;
    /* 8px → 8px */
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.5);
    /* 4px → 4px */
}

/* 圖片本體 */
.menu-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

/* 無圖片時的佔位色塊 */
.menu-item-img-placeholder {
    background: linear-gradient(135deg,
            rgba(244, 228, 160, 0.08) 0%,
            rgba(93, 24, 24, 0.25) 100%);
    border: 1px dashed rgba(244, 228, 160, 0.2);
}

.menu-item-img-placeholder::after {
    content: '🎮';
    font-size: 30px;
    /* 30px → 30px */
    opacity: 0.3;
}

/* 文字標籤（固定在下方） */
.menu-item-label {
    font-family: 'Noto Sans TC';
    /*思源黑體*/
    /*font-family: monospace;*/
    /*標楷體*/
    font-size: 24px;
    /* 24px → 24px */
    font-weight: 300;
    letter-spacing: 0.05em;
    text-align: center;
    color: #f4e4a0;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* 禁用的選單項目 */
.menu-item-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.menu-item-disabled:hover {
    background-color: transparent;
    transform: none;
}

/* ========================================
   遮罩層（點擊關閉選單）
   ======================================== */
.menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 29980;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   遊戲過關次數進度條
   ======================================== */
.menu-playcount-wrap {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 2px;
}

.menu-playcount-bar {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.5s ease;
}