/* =================================================
   Neon Metaverse CSS - 科幻偽3D視覺系統
   版本: 2.0 - 完美手機體驗 + 全局引導
   ================================================= */

/* ==================== 基礎樣式 ==================== */
#meta-world-container {
    font-family: 'Arial', 'Microsoft YaHei', 'PingFang TC', sans-serif;
    user-select: none;
    overflow: hidden;
    perspective: 1000px;
    transform-style: preserve-3d;
}

#meta-world-container * {
    box-sizing: border-box;
}

/* 全局滾動條美化 */
#meta-world-container *::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#meta-world-container *::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
}

#meta-world-container *::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00ffff, #0080ff);
    border-radius: 4px;
}

#meta-world-container *::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00ffff, #00aaff);
}

/* ==================== 主容器 ==================== */
.meta-main-container {
    animation: fadeIn 0.4s ease-out;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

/* 確保背景不阻擋點擊 */
#neon-galaxy-bg {
    z-index: 1 !important;
    pointer-events: none !important;
}

/* ========== Meta Tab 按鈕完整修復 ========== */
/* 確保tab文字可見 - 修復文字/圖標缺失問題 */
.meta-tab-btn {
    position: relative !important;
    z-index: 20 !important;
    pointer-events: auto !important;
    overflow: visible !important;
    background: rgba(0, 20, 40, 0.8) !important;
    border: 1px solid rgba(0, 255, 255, 0.3) !important;
    color: #ffffff !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    min-height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    word-wrap: break-word !important;
    border-radius: 8px !important;
    margin: 0 2px !important;
    padding: 8px 12px !important;
}

/* 活躍狀態 */
.meta-tab-btn.active {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.3), rgba(0, 128, 255, 0.3)) !important;
    border-color: #00ffff !important;
    color: #00ffff !important;
    font-weight: bold !important;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8) !important;
}

/* 確保按鈕內容容器可見 */
.meta-tab-btn > div:not(.tab-highlight),
.meta-tab-btn > span {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
    z-index: 21 !important;
    pointer-events: none !important;
    overflow: visible !important;
    gap: 2px !important;
}

/* Tab 標籤文字 */
.meta-tab-btn .tab-label,
.meta-tab-btn .tab-title,
.meta-tab-btn > div > *:first-child {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    line-height: 1.2 !important;
    position: relative !important;
    z-index: 22 !important;
    pointer-events: none !important;
    overflow: visible !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    width: 100% !important;
    text-align: center !important;
}

/* Tab 圖標 */
.meta-tab-btn .tab-icon,
.meta-tab-btn [class*="icon"],
.meta-tab-btn > div > span:first-child {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 18px !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    position: relative !important;
    z-index: 22 !important;
    pointer-events: none !important;
    flex-shrink: 0 !important;
    width: auto !important;
    height: auto !important;
    margin-bottom: 2px !important;
    text-align: center !important;
}

/* Tab 描述文字 */
.meta-tab-btn .tab-desc,
.meta-tab-btn .tab-subtitle,
.meta-tab-btn > div > *:last-child {
    display: block !important;
    visibility: visible !important;
    opacity: 0.8 !important;
    font-size: 11px !important;
    position: relative !important;
    z-index: 22 !important;
    pointer-events: none !important;
    overflow: visible !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    width: 100% !important;
    text-align: center !important;
    color: rgba(255, 255, 255, 0.8) !important;
}

/* 修復所有可能的文字隱藏問題 */
.meta-tab-btn *,
.meta-tab-btn *:before,
.meta-tab-btn *:after {
    color: inherit !important;
    visibility: visible !important;
    opacity: inherit !important;
}

/* 強制顯示所有子元素 */
.meta-tab-btn * {
    display: inherit !important;
}

/* 特別確保圖標顯示 */
.meta-tab-btn .tab-icon {
    display: inline-block !important;
    font-size: 18px !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    flex-shrink: 0 !important;
}

/* 特別確保標籤顯示 */
.meta-tab-btn .tab-label {
    display: block !important;
    font-weight: bold !important;
    flex: 1 !important;
}

/* ==================== 頂部導航欄 ==================== */
.meta-nav-bar {
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 15px rgba(0,0,0,0.3);
}

/* Tab 按鈕懸停效果 */
.meta-tab-btn:hover {
    /* 移除位移，僅保留背景/邊框/文字顏色漸變，避免容器高度變化和視覺浮起 */
    transform: none !important;
    /* 保持原始 box-shadow，不改變陰影大小，避免視覺上的浮起效果 */
    /* box-shadow 由內聯樣式控制，hover 時不改變，使用 !important 確保不被覆蓋 */
    box-shadow: inherit !important;
}

.meta-tab-btn:active {
    transform: none;
}

/* Tab 圖標動畫 */
.tab-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.meta-tab-btn:hover .tab-icon {
    /* 移除縮放，避免影響容器布局 */
    transform: none;
}

/* ==================== 內容區域 ==================== */
#meta-content-area {
    background: rgba(0,0,0,0.2);
}

#meta-content-area::-webkit-scrollbar {
    width: 10px;
}

#meta-content-area::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
}

#meta-content-area::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00ffff, #0080ff);
    border-radius: 5px;
}

#meta-content-area::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00aaff, #0060ff);
}

/* ==================== 拍賣卡片 ==================== */
.auction-card {
    position: relative;
    overflow: hidden;
}

.auction-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0,255,255,0.2), transparent);
    transition: left 0.6s ease;
}

.auction-card:hover::before {
    left: 100%;
}

.auction-card img {
    transition: transform 0.3s ease;
}

.auction-card:hover img {
    transform: scale(1.05);
}

.enter-auction-btn {
    position: relative;
    overflow: hidden;
}

.enter-auction-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.enter-auction-btn:active::after {
    width: 300px;
    height: 300px;
}

/* ==================== 拍賣詳情模態框 ==================== */
#auction-detail-modal {
    backdrop-filter: blur(15px);
}

#auction-detail-modal input[type="number"] {
    transition: all 0.3s ease;
}

#auction-detail-modal input[type="number"]:focus {
    outline: none;
    box-shadow: 0 0 20px rgba(0,255,255,0.6);
    transform: scale(1.02);
}

/* ==================== 寶貝抽獎 ==================== */
.gacha-container {
    animation: slideInUp 0.5s ease-out;
}

.gacha-container button {
    transition: all 0.3s ease;
    position: relative;
}

.gacha-container button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255,202,87,0.6);
}

.gacha-container button:active {
    transform: translateY(-1px);
}

/* 抽獎結果卡片動畫 */
#gacha-result > div {
    animation: bounceIn 0.6s ease-out;
}

/* ==================== 礦工寶貝卡片 ==================== */
#meta-panel-monsters > div > div > div {
    transition: background 0.2s, border 0.2s, color 0.2s;
    /* 移除位移和陰影變化，避免容器錯位 */
    transform: none !important;
}

#meta-panel-monsters > div > div > div:hover {
    /* 僅保留背景/邊框/文字顏色漸變，不改變位置 */
    transform: none !important;
}

/* ==================== 捕捉套餐模態框 ==================== */
.capture-pack:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,255,255,0.5) !important;
}

/* ==================== 礦工寶貝選擇 ==================== */
.monster-choice:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,255,0,0.5);
}

/* ==================== 動畫定義 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* fadeOut 動畫已移除（未使用） */

/* 保留必要的動畫：fadeIn（用於主容器）和 bounceIn（用於抽獎結果） */
@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    70% {
        transform: scale(0.9);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 保留 pulse 動畫（用於載入動畫） */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* ==================== 載入動畫 ==================== */
.loading-spinner {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ==================== 手機觸控優化增強 ==================== */
/* 快速點擊響應 */
button,
.auction-card,
.monster-card,
.meta-tab-btn {
    -webkit-tap-highlight-color: rgba(0,255,255,0.3);
}

/* 觸摸反饋動畫 */
@keyframes tapFeedback {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* 按鈕觸控反饋 */
button:active {
    animation: tapFeedback 0.2s ease;
}

/* ========== Meta系統終極焦點修復 ========== */
/* 修復快速出價按鈕的焦點狀態問題 */
#meta-world-container button:focus,
#meta-world-container .meta-tab-btn:focus,
#meta-world-container input:focus,
button:focus {
    outline: none !important;
    transform: none !important;
    scale: 1 !important;
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.4) !important;
}

#meta-world-container button:focus:not(:hover),
button:focus:not(:hover) {
    transform: none !important;
    scale: 1 !important;
}

/* 防止按鈕在獲得焦點時被放大 */
div[style*="grid-template-columns"] button:focus,
#meta-world-container div[style*="grid-template-columns"] button:focus {
    transform: none !important;
    scale: 1 !important;
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.4), 0 2px 8px rgba(0,0,0,0.1) !important;
}

/* 確保Meta系統的所有按鈕都遵循統一規則 */
#meta-world-container *:focus,
.meta-main-container *:focus {
    transform: none !important;
    scale: 1 !important;
}

/* Meta系統按鈕增強樣式 - 補充缺失的CSS */
.meta-container button {
    transition: all 0.3s ease;
    transform: none;
    scale: 1;
}

.meta-container button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.meta-container button:focus {
    outline: none;
    transform: none !important;
    scale: 1 !important;
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.5) !important;
}

.meta-container button:focus:not(:hover) {
    transform: none !important;
    scale: 1 !important;
}

/* 修復碎片管理等按鈕樣式 */
button[onclick*="showFragmentManager"], 
button[onclick*="drawGacha"],
button[onclick*="metaverse"] {
    transition: all 0.3s ease !important;
    transform: none !important;
    scale: 1 !important;
}

button[onclick*="showFragmentManager"]:hover, 
button[onclick*="drawGacha"]:hover,
button[onclick*="metaverse"]:hover {
    transform: translateY(-2px) scale(1.02) !important;
}

button[onclick*="showFragmentManager"]:focus, 
button[onclick*="drawGacha"]:focus,
button[onclick*="metaverse"]:focus {
    outline: none !important;
    transform: none !important;
    scale: 1 !important;
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.5) !important;
}

/* 卡片觸控反饋 */
.auction-card:active,
.monster-card:active {
    animation: tapFeedback 0.3s ease;
}

/* 滑動手勢優化 */
.meta-tabs-container {
    scroll-snap-type: x mandatory;
    scroll-padding: 0 20px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    scroll-behavior: smooth;
    /* 布局隔離與水平手勢限定，避免子元素 hover 影響容器布局 */
    touch-action: pan-x;
    overscroll-behavior-y: none;
    contain: layout paint;
    will-change: scroll-position;
}

.meta-tabs-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.meta-tab-btn {
    scroll-snap-align: start;
    white-space: nowrap;
    flex-shrink: 0;
    /* 強制移除位移，避免 hover 造成容器高度變化 */
    transform: none !important;
    /* 僅允許背景/邊框/文字顏色漸變，不包含 box-shadow 避免視覺浮起 */
    transition: background 0.2s, border 0.2s, color 0.2s !important;
}

/* 下拉刷新提示（預留） */
.pull-to-refresh {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    color: #00ffff;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pull-to-refresh.visible {
    opacity: 1;
}

/* 震動反饋類（需JS配合） */
.vibrate-feedback {
    animation: vibrateEffect 0.3s ease;
}

@keyframes vibrateEffect {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-2px);
    }
    75% {
        transform: translateX(2px);
    }
}

/* 手勢滑動指示器 */
.swipe-indicator {
    position: relative;
}

.swipe-indicator::after {
    content: '→';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: rgba(0,255,255,0.3);
    animation: swipeHint 2s ease-in-out infinite;
}

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

/* ==================== 響應式設計 ==================== */
@media (max-width: 768px) {
    .meta-nav-bar {
        padding: 10px !important;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .meta-tabs-container {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        scroll-snap-type: x mandatory;
        padding-bottom: 5px;
        /* 確保在iOS上可以平滑滾動 */
        -webkit-overflow-scrolling: touch;
        /* 布局隔離與水平手勢限定 */
        touch-action: pan-x;
        overscroll-behavior-y: none;
        contain: layout paint;
        will-change: scroll-position;
    }
    
    .meta-tabs-container::-webkit-scrollbar {
        display: none;
    }
    
    .meta-tab-btn {
        scroll-snap-align: start;
        /* 確保觸控區域足夠大 */
        min-width: 80px;
        min-height: 44px;
        /* 強制移除位移，避免 hover 造成容器高度變化 */
        transform: none !important;
        /* 僅允許背景/邊框/文字顏色漸變，不包含 box-shadow 避免視覺浮起 */
        transition: background 0.2s, border 0.2s, color 0.2s !important;
    }
    
    #meta-content-area {
        padding: 15px !important;
        /* 確保內容不會被導航欄遮擋 */
        padding-top: calc(15px + env(safe-area-inset-top));
    }
    
    .auctions-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
        /* 確保最後一個元素有足夠的底部間距 */
        padding-bottom: env(safe-area-inset-bottom, 15px);
    }
    
    .auction-card {
        padding: 15px !important;
        /* 確保卡片內容不會溢出 */
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* 拍賣詳情模態框 */
    #auction-detail-modal {
        padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
    }
    
    #auction-detail-modal > div {
        padding: 20px !important;
        max-width: 95% !important;
        max-height: calc(100vh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        overflow-y: auto;
    }
    
    /* 捕捉套餐 */
    .capture-pack {
        min-width: 100% !important;
    }
    
    /* 引導內容優化 */
    .guide-content {
        max-height: calc(90vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        overflow-y: auto;
        /* 確保在iOS上可以滾動 */
        -webkit-overflow-scrolling: touch;
    }
    
    /* 確保所有按鈕在手機上都有足夠的觸控區域 */
    button {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }
    
    /* 確保輸入框足夠大 */
    input[type="number"],
    input[type="text"] {
        min-height: 44px;
        font-size: 16px; /* 防止iOS自動縮放 */
    }
}

@media (max-width: 480px) {
    /* 超小屏幕Tab按鈕優化 */
    .meta-tab-btn {
        padding: 10px 12px !important;
        font-size: 13px !important;
        min-width: 85px;
        min-height: 44px;
        /* 確保文字不會太小 */
        line-height: 1.2;
    }
    
    .tab-icon {
        font-size: 18px;
        /* 確保圖標清晰 */
        display: inline-block;
        vertical-align: middle;
    }
    
    .tab-desc {
        display: none !important;
    }
    
    /* 確保tab標籤文字可見 */
    .tab-label {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* 按鈕觸控區域優化 */
    button {
        min-height: 44px;
        min-width: 44px;
        font-size: 14px; /* 確保文字可讀 */
        padding: 12px 16px;
    }
    
    /* 卡片間距優化 */
    .auction-card,
    .monster-card {
        margin-bottom: 15px; /* 增加間距避免誤觸 */
    }
    
    /* 確保文字大小符合WCAG標準（最小12px） */
    body,
    #meta-world-container {
        font-size: 14px; /* 基礎字體大小 */
    }
    
    /* 小文字至少12px */
    small,
    .small-text {
        font-size: 12px !important;
    }
    
    /* 標題文字優化 */
    h1 { font-size: 24px !important; }
    h2 { font-size: 20px !important; }
    h3 { font-size: 18px !important; }
    h4 { font-size: 16px !important; }
    
    /* 確保重要信息清晰可見 */
    .important-text {
        font-size: 15px !important;
        font-weight: 600;
    }
}

/* 橫屏模式優化 */
@media (max-width: 900px) and (orientation: landscape) {
    .guide-content {
        max-width: 80vw;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .meta-nav-bar {
        padding: 8px 15px !important;
    }
    
    #meta-content-area {
        padding: 10px !important;
    }
}

/* ==================== 觸摸設備優化 ==================== */
@media (any-hover: none) and (any-pointer: coarse) {
    button,
    .auction-card,
    .capture-pack,
    .monster-choice,
    .meta-tab-btn {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0,255,255,0.2); /* 保留輕微反饋 */
    }
    
    /* 確保所有可點擊元素都有足夠的間距 */
    button + button,
    .auction-card + .auction-card,
    .monster-card + .monster-card {
        margin-top: 12px;
    }
    
    /* 取消懸停效果，使用active狀態 */
    .auction-card:hover::before {
        left: -100%;
    }
    
    .auction-card:active {
        transform: scale(0.97);
        transition: transform 0.1s ease;
    }
    
    button:hover {
        transform: none !important;
    }
    
    button:active {
        transform: scale(0.95) !important;
        opacity: 0.9;
    }
    
    /* 觸控反饋增強 */
    .meta-tab-btn:active {
        background: rgba(0,255,255,0.3) !important;
    }
    
    /* 滾動性能優化 */
    #meta-content-area,
    .meta-tabs-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* 禁止長按選擇 */
    * {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }
    
    /* 允許輸入框選擇 */
    input,
    textarea {
        -webkit-user-select: text;
        user-select: text;
    }
}

/* ==================== 高對比度優化 ==================== */
@media (prefers-contrast: high) {
    .meta-nav-bar,
    .auction-card,
    #auction-detail-modal > div,
    .monster-card {
        border-width: 3px !important;
        border-color: #00ffff !important;
    }
    
    .meta-tab-btn {
        font-weight: 900 !important;
        border-width: 3px !important;
    }
    
    /* 提升文字對比度 */
    #meta-world-container {
        color: #ffffff !important;
    }
    
    /* 次要文字也要清晰 */
    .secondary-text,
    span[style*="color: #aaa"],
    span[style*="color: #888"] {
        color: #cccccc !important;
    }
    
    /* 按鈕文字對比度 */
    button {
        color: #000000 !important;
        background: #00ffff !important;
        border: 3px solid #000000 !important;
    }
}

/* ==================== 減少動畫（用戶偏好） ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        /* 禁用3D變換 */
        transform: none !important;
    }
    
    /* 保留必要的過渡（如模態框顯示） */
    #meta-world-container,
    .guide-overlay,
    .help-modal {
        animation: fadeIn 0.2s ease-out !important;
    }
}

/* ==================== 深色模式優化 ==================== */
@media (prefers-color-scheme: dark) {
    /* 已經是深色主題，無需額外調整 */
}

/* ==================== 淺色模式優化（如果用戶偏好） ==================== */
@media (prefers-color-scheme: light) {
    #meta-world-container {
        background: linear-gradient(135deg, rgba(0,0,0,0.95) 0%, rgba(10,10,30,0.95) 100%) !important;
    }
    
    .auction-card,
    #auction-detail-modal > div {
        background: linear-gradient(135deg, rgba(0,20,40,0.98), rgba(10,10,30,0.98)) !important;
        color: #ffffff !important;
    }
}

/* ==================== 無障礙優化 ==================== */
/* 聚焦狀態 */
button:focus-visible,
input:focus-visible,
.meta-tab-btn:focus-visible {
    outline: 3px solid #00ffff;
    outline-offset: 2px;
    outline-style: solid;
}

/* 確保所有可交互元素都有焦點指示 */
a:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid #00ffff;
    outline-offset: 2px;
}

/* 顏色對比度優化 */
/* 確保文字在深色背景上可讀 */
#meta-world-container {
    color: #ffffff;
}

/* 次要文字使用較亮的灰色以確保可讀性 */
.secondary-text {
    color: #cccccc !important; /* 從#aaa提升到#ccc */
}

/* 禁用文字使用較暗但仍可讀的顏色 */
.disabled-text {
    color: #999999 !important; /* 從#666提升到#999 */
}

/* 跳過連結（鍵盤導航） */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #00ffff;
    color: #000;
    padding: 8px;
    text-decoration: none;
    z-index: 100000;
}

.skip-link:focus {
    top: 0;
}

/* ==================== 打印優化 ==================== */
@media print {
    #meta-world-container {
        display: none !important;
    }
}

/* ==================== 引導系統樣式 ==================== */
.guide-overlay {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.guide-content {
    transform-style: preserve-3d;
}

.help-modal {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ==================== 3D卡片效果 ==================== */
.auction-card,
.monster-card,
.gacha-result-card {
    transform-style: preserve-3d;
    transform: perspective(1000px) translateZ(0);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.auction-card:hover,
.monster-card:hover {
    transform: perspective(1000px) translateZ(20px) rotateY(2deg);
}

/* 3D懸浮卡片陰影 */
.auction-card::after,
.monster-card::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 10px;
    background: radial-gradient(ellipse, rgba(0,255,255,0.3), transparent);
    filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auction-card:hover::after,
.monster-card:hover::after {
    opacity: 1;
}

/* ==================== 特殊效果 ==================== */
/* 霓虹發光文字 */
.neon-glow {
    text-shadow: 
        0 0 5px #00ffff,
        0 0 10px #00ffff,
        0 0 20px #00ffff,
        0 0 40px #00ffff;
}

/* 霓虹發光邊框 */
.neon-border-glow {
    box-shadow: 
        0 0 5px rgba(0,255,255,0.5),
        0 0 10px rgba(0,255,255,0.4),
        0 0 20px rgba(0,255,255,0.3),
        inset 0 0 10px rgba(0,255,255,0.2);
}

/* 脈衝效果 */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0,255,255,0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(0,255,255,0.8);
    }
}

.pulse-effect {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* 彩虹漸變效果 */
@keyframes rainbow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

.rainbow-effect {
    animation: rainbow 3s linear infinite;
}

/* 玻璃態效果 */
.glass-effect {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

/* 全息圖效果 */
.hologram-effect {
    background: linear-gradient(135deg, 
        rgba(0,255,255,0.1), 
        rgba(255,0,255,0.1), 
        rgba(0,255,255,0.1)
    );
    background-size: 200% 200%;
    animation: hologramShift 4s ease infinite;
    border: 1px solid rgba(0,255,255,0.3);
    box-shadow: inset 0 0 20px rgba(0,255,255,0.1);
}

@keyframes hologramShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* ==================== 性能優化 ==================== */
/* 拍賣氣氛動畫效果 */
@keyframes bidSlideIn {
    0% { 
        transform: translateY(-20px) scale(0.95); 
        opacity: 0; 
    }
    50% {
        transform: translateY(-5px) scale(1.02);
        opacity: 0.8;
        box-shadow: 0 0 25px rgba(255,215,0,0.4);
    }
    100% { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
}

@keyframes winningPulse {
    0%, 100% { 
        box-shadow: 0 2px 15px rgba(255,215,0,0.2);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 4px 25px rgba(255,215,0,0.4); 
        transform: scale(0.98);
    }
}

@keyframes historyUpdate {
    0% { opacity: 0.7; transform: translateY(-5px); }
    100% { opacity: 1; transform: translateY(0); }
}

.new-bid-entry {
    animation: bidSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bid-entry:first-child {
    animation: winningPulse 3s ease-in-out infinite;
}

.bid-history-updating {
    animation: historyUpdate 0.3s ease-out;
}

/* GPU加速 */
.auction-card,
.meta-tab-btn,
button,
.monster-card {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    /* 優化渲染性能 */
    contain: layout style paint;
}

/* 避免不必要的重繪 */
#meta-content-area {
    contain: layout style;
}

/* 圖片優化 */
img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
    /* 防止圖片載入時的布局跳動 */
    aspect-ratio: attr(width) / attr(height);
}

/* 防止字體閃爍 */
@font-face {
    font-display: swap;
}

/* 延遲載入圖片 */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* ========== CSS統一規則 - 減少與主系統衝突 ========== */
/* Meta系統優先使用主系統CSS變數 */
#meta-world-container {
    /* 繼承主系統的CSS變數 */
    --neon-pink: #ff00ff;
    --neon-cyan: #00ffff;
    --neon-green: #00ff00;
    --neon-yellow: #ffff00;
    --neon-orange: #ff8000;
    --neon-purple: #8000ff;
    --neon-red: #ff0040;
    --neon-blue: #0080ff;
    
    --bg-dark: #0a0a0a;
    --bg-card: #1a1a1a;
    --bg-input: #2a2a2a;
    
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #888888;
    
    --glow-size: 0 0 20px;
    --glow-intense: 0 0 30px;
    --shadow-3d: 0 4px 8px rgba(0,0,0,0.3);
}

/* 重複使用主系統的按鈕樣式，避免衝突 */
#meta-world-container .neon-button {
    background: linear-gradient(145deg, #333, #555) !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 15px 30px !important;
    color: var(--text-primary) !important;
    font-size: 1rem !important;
    font-weight: bold !important;
    cursor: pointer !important;
    position: relative !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    min-width: 120px !important;
    box-shadow: var(--shadow-3d) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    overflow: hidden !important;
}

#meta-world-container .neon-button.primary {
    background: linear-gradient(145deg, #ff006e, #8338ec) !important;
    box-shadow: 
        var(--shadow-3d),
        var(--glow-size) var(--neon-pink) !important;
}

#meta-world-container .neon-button.secondary {
    background: linear-gradient(145deg, #06ffa5, #00d4aa) !important;
    box-shadow: 
        var(--shadow-3d),
        var(--glow-size) var(--neon-cyan) !important;
}

/* 統一輸入框樣式 */
#meta-world-container .neon-input,
#meta-world-container input[type="number"],
#meta-world-container input[type="text"] {
    background: var(--bg-input) !important;
    border: 2px solid #444 !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    color: var(--text-primary) !important;
    font-size: 16px !important;
    width: 100% !important;
    transition: all 0.3s ease !important;
    font-family: inherit !important;
}

#meta-world-container .neon-input:focus,
#meta-world-container input:focus {
    outline: none !important;
    border-color: var(--neon-cyan) !important;
    box-shadow: 
        0 0 0 3px rgba(0, 255, 255, 0.1),
        var(--glow-size) var(--neon-cyan) !important;
    background: #333 !important;
}

/* 修復快速出價按鈕焦點問題 */
#meta-world-container button:focus:not(:hover):not(:active) {
    transform: none !important;
    scale: 1 !important;
    outline: 2px solid rgba(0, 255, 255, 0.5) !important;
    outline-offset: 2px !important;
}

#meta-world-container button:hover {
    transform: translateY(-2px) scale(1.02) !important;
}

/* ==================== 輔助類 ==================== */
.text-center {
    text-align: center;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.p-10 {
    padding: 10px;
}

.p-20 {
    padding: 20px;
}

/* 隱藏類 */
.hidden {
    display: none !important;
}

.invisible {
    visibility: hidden !important;
}

/* 禁用類 */
.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed !important;
}
