/**
 * 阿鹿小站 v2.0 - 單機圍棋專屬樣式表 (game/go/go_local.css)
 */

/* 全局背景與滾動優化 (防止 iOS / Safari 下拉露餡，並強制鎖死 Google AdSense 頂部自動推擠) */
html, body {
    background-color: #f1f5f9 !important;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 50%, #f8fafc 100%) !important;
    margin: 0 !important;
    padding: 0 !important;
    padding-top: 0px !important;
    margin-top: 0px !important;
    -webkit-overflow-scrolling: touch;
}

/* 🚫 徹底抹除 Google AdSense 在頂部預留的隱形佔位容器 */
.google-auto-placed,
ins.adsbygoogle[data-anchor-status="displayed"],
div[id^="aswift_"][style*="position: fixed; top: 0"],
div[id^="aswift_"][style*="position: fixed; top:0"],
div[id^="google_ads_iframe"][style*="position: fixed; top: 0"] {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 頁面背景與主容器 (優雅明亮自然光感) */
.go-page-container {
    background: transparent;
    color: #1e293b;
    padding: 8px 12px 24px 12px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    font-family: 'Outfit', 'Inter', 'SF Pro TC', sans-serif;
    box-sizing: border-box;
}

/* 雙欄主外殼 (方案 A：寬度收斂至 920px，確保電腦螢幕兩側有足夠空間留給 Google 側邊廣告，絕不遮擋) */
.go-layout-wrapper {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 920px;
    align-items: flex-start;
}

/* 棋盤區域佔比 */
.go-board-section {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* 棋盤精緻卡片 (清新白底浮雕感) */
.go-board-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 16px 18px 14px 18px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 棋盤頂部狀態列 */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.board-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.board-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-board-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    line-height: 1.2;
    white-space: nowrap;
}

.btn-top-pass {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.btn-top-pass:hover:not(:disabled) {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

.btn-top-resign {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.btn-top-resign:hover:not(:disabled) {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #f87171;
}

.status-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transition: all 0.3s ease;
}

.status-badge.white-turn {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.timer-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Outfit', monospace;
    white-space: nowrap;
    line-height: 1.2;
}

.timer-badge #game-timer-text {
    color: #0f172a;
    letter-spacing: 0.5px;
}

/* Canvas 棋盤容器與 aspect-ratio 強制方形 */
.canvas-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12), inset 0 0 10px rgba(0, 0, 0, 0.2);
}

#go-canvas {
    width: 100%;
    height: 100%;
    background: #e5c07b; /* 經典榧木木質黃色 */
    display: block;
    cursor: crosshair;
    border-radius: 12px;
}

/* 控制側邊欄 (緊湊俐落佈局，配合方案 A) */
.go-control-sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* 精緻明亮白底資訊卡片 */
.control-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.control-card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 14px;
    border-left: 4px solid #2563eb;
    padding-left: 10px;
    color: #0f172a;
}

/* 玩家 VS 狀態區 */
.player-vs-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.player-info {
    flex: 1;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    padding: 14px 10px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.player-info.active {
    background: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

.player-info.black.active {
    background: #f1f5f9;
    border-color: #475569;
    box-shadow: 0 0 12px rgba(71, 85, 105, 0.2);
}

.stone-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    box-shadow: 0 3px 6px rgba(0,0,0,0.25);
}

.stone-icon.black {
    background: radial-gradient(circle at 30% 30%, #475569, #0f172a);
    border: 1px solid #0f172a;
}

.stone-icon.white {
    background: radial-gradient(circle at 30% 30%, #ffffff, #cbd5e1);
    border: 1px solid #94a3b8;
}

.player-info .name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
}

.player-info .captures {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

.vs-divider {
    font-size: 0.8rem;
    font-weight: 800;
    color: #94a3b8;
}

/* 遊戲設定表單項目 */
.setting-group {
    margin-bottom: 16px;
}

.setting-group label {
    display: block;
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 8px;
    font-weight: 600;
}

/* 按鈕群組 */
.btn-group {
    display: flex;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
    border: 1px solid #e2e8f0;
}

.btn-option {
    flex: 1;
    background: transparent;
    border: none;
    color: #64748b;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-option:hover {
    color: #0f172a;
}

.btn-option.active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* 下拉選單 */
.select-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    padding: 9px 12px;
    border-radius: 8px;
    outline: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-control:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* 行動按鈕 */
.action-buttons {
    display: flex;
    gap: 12px;
}

.btn-action {
    flex: 1;
    border: none;
    padding: 11px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action.btn-danger {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(239, 68, 68, 0.25);
}

.btn-action.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-action.btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.btn-action.btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* 規則說明列表 */
.rules-list {
    padding-left: 18px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.84rem;
    color: #475569;
    line-height: 1.6;
}

.rules-list li strong {
    color: #0f172a;
}

/* 手機版落子放大鏡/準星 */
.go-magnifier {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #2563eb;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    background: #e5c07b;
    pointer-events: none; /* 避免擋住點擊事件 */
    z-index: 100;
    overflow: hidden;
}

#magnifier-canvas {
    width: 100%;
    height: 100%;
}

/* ------------------------------------------- */
/* 📱 響應式佈局 (RWD) Media Queries */
/* ------------------------------------------- */
@media (max-width: 900px) {
    .go-layout-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .go-board-section {
        width: 100%;
    }

    .go-control-sidebar {
        width: 100%;
        max-width: 620px;
    }
    
    .go-page-container {
        padding: 6px 8px;
    }
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* =========================================================
   📊 即時勝率分析條樣式 (極簡緊湊膠囊條)
   ========================================================= */
.winrate-compact-container {
    width: 100%;
    margin: 2px 0 2px 0;
}

.winrate-bar-track {
    width: 100%;
    height: 22px;
    border-radius: 11px;
    overflow: hidden;
    background: linear-gradient(90deg, #f8fafc, #e2e8f0); /* 白棋勝率背景 */
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
    position: relative;
    box-sizing: border-box;
}

.winrate-progress {
    height: 100%;
    background: linear-gradient(90deg, #090d16, #1e293b); /* 黑棋勝率進度條 */
    transition: width 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-right: 2px solid #38bdf8; /* 天空藍指示分割線 */
    box-sizing: border-box;
}

.winrate-overlay-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    font-size: 0.72rem;
    font-weight: 700;
    pointer-events: none;
    box-sizing: border-box;
}

#winrate-black-label {
    color: #f1f2f6;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

#winrate-white-label {
    color: #1e293b;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* =========================================================
   🎯 玩家落子確認列 (棋盤正下方操作欄)
   ========================================================= */
.confirm-move-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-sizing: border-box;
    min-height: 52px;
    gap: 12px;
}

.confirm-hint-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.confirm-hint-text strong {
    color: #0f172a;
}

.confirm-hint-text.selected {
    color: #2563eb;
}

.confirm-hint-text.ai-thinking {
    color: #d97706;
}

.confirm-action-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-cancel-move {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #dc2626;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel-move:hover {
    background: #fecaca;
    color: #b91c1c;
    border-color: #f87171;
}

.btn-confirm-move {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: #ffffff;
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-confirm-move:hover:not(:disabled) {
    background: linear-gradient(135deg, #34d399, #10b981);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
    transform: translateY(-1px);
}

.btn-confirm-move:active:not(:disabled) {
    transform: translateY(0);
}

.btn-confirm-move:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

/* 複盤控制卡片微調 */
.review-card .btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    padding: 10px 0;
}

.review-card .btn-danger:hover {
    background: #ff6b81 !important;
    transform: translateY(-1px);
}

/* =========================================================
   🚫 廣告防禦：停用頂部與底部自動覆蓋錨定廣告 (Anchor Ads)
   （保留側邊滑軌廣告 Side Rails，因版面已收斂至 920px，兩側有完整安全留白）
   ========================================================= */
.google-auto-placed,
ins.adsbygoogle[data-anchor-status],
ins.adsbygoogle[data-anchor-shown="true"],
#aswift_0_anchor__container,
#aswift_1_anchor__container,
#aswift_2_anchor__container,
#aswift_3_anchor__container,
#aswift_4_anchor__container,
#aswift_5_anchor__container,
div[id^="aswift_"][id$="_anchor__container"],
iframe[id^="google_ads_iframe"][id*="anchor"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

/* =========================================================
   🏆 結算結果彈窗 (Game Over Modal) 樣式
   ========================================================= */
.go-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10001 !important;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)) 16px;
    box-sizing: border-box;
    animation: fadeInModal 0.25s ease-out;
}

.go-modal-overlay.active,
.go-modal-overlay[style*="display: flex"] {
    display: flex !important;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.go-modal-box {
    background: #ffffff;
    width: 100%;
    max-width: 480px;
    border-radius: 18px;
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(226, 232, 240, 0.8);
    padding: 24px 22px;
    position: relative;
    margin: auto !important;
    box-sizing: border-box;
    animation: slideUpModal 0.25s ease-out;
    max-height: calc(85dvh - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@keyframes slideUpModal {
    from {
        transform: translateY(20px) scale(0.96);
    }
    to {
        transform: translateY(0) scale(1);
    }
}

.go-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: #f1f5f9;
    border: none;
    color: #64748b;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.go-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: rotate(90deg);
}

.go-modal-header {
    text-align: center;
    margin-bottom: 16px;
}

.go-modal-badge {
    display: inline-block;
    background: #fef3c7;
    color: #b45309;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.go-modal-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.go-modal-subtitle {
    font-size: 0.88rem;
    color: #64748b;
    margin: 0;
}

/* 比數卡片 */
.go-modal-scorecard {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
}

.score-col {
    flex: 1;
    text-align: center;
}

.score-player {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 4px;
}

.score-num {
    font-size: 1.7rem;
    font-weight: 900;
    color: #0f172a;
    line-height: 1.1;
    margin-bottom: 4px;
}

.score-breakdown {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.3;
}

.score-vs {
    font-weight: 900;
    font-size: 0.85rem;
    color: #94a3b8;
    padding: 0 8px;
}

/* 📢 廣告版位容器 */
.go-modal-ad-section {
    margin-bottom: 18px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 8px;
    text-align: center;
}

.go-modal-ad-section .ad-label {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.go-modal-ad-section .ad-container {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 6px;
    overflow: hidden;
}

/* 操作按鈕群 */
.go-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    box-sizing: border-box;
}

.modal-btn.btn-primary {
    background: #2563eb;
    color: #ffffff;
    grid-column: span 2;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.modal-btn.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.modal-btn.btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.modal-btn.btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.modal-btn.btn-outline {
    background: #ffffff;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.modal-btn.btn-outline:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}

@media (max-width: 480px) {
    .go-modal-box {
        padding: 20px 16px;
    }
    .go-modal-title {
        font-size: 1.25rem;
    }
    .score-num {
        font-size: 1.45rem;
    }
    .modal-btn {
        padding: 10px 12px;
        font-size: 0.88rem;
    }
}

/* =========================================================
   🎮 圍棋大廳首頁 (Game Lobby Screen) 樣式
   ========================================================= */
.go-lobby-screen {
    width: 100%;
    max-width: 920px; /* 💡 與第二頁棋局主體 (920px) 保持完全一致的寬度佔位，讓 Google 側邊廣告一開始就吸附在 920px 兩側安全外圍 */
    margin: 8px auto 20px auto;
    padding: 0 16px;
    box-sizing: border-box;
    animation: fadeInLobby 0.35s ease-out;
}

@keyframes fadeInLobby {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.go-lobby-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.08), 0 0 0 1px #e2e8f0;
    padding: 32px 28px;
    text-align: center;
    box-sizing: border-box;
    max-width: 580px; /* 首頁內容卡片維持優雅居中 */
    margin: 0 auto;
}

.lobby-logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

.lobby-brand-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.lobby-brand-logo:hover {
    transform: scale(1.05);
}

.lobby-title {
    font-size: 2.1rem;
    font-weight: 900;
    color: #0f172a;
    margin: 0 0 12px 0;
    letter-spacing: 0.5px;
}

/* 👤 棋士身分與快速登入膠囊列 */
.lobby-player-bar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 22px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 30px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.player-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 700;
}

.player-pill.guest {
    color: #64748b;
}

.player-pill.member {
    color: #1e293b;
}

.player-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

.player-pill.member .player-dot {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.btn-quick-login {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #ffffff;
    background: #2563eb;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-quick-login:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* ⚔️ 圍棋大廳模式切換分頁 (人機挑戰 vs 真人線上對局) */
.lobby-mode-switch {
    display: flex;
    background: #e2e8f0;
    padding: 4px;
    border-radius: 14px;
    margin-bottom: 18px;
    gap: 4px;
}

.btn-mode-tab {
    flex: 1;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    user-select: none;
}

.btn-mode-tab:hover:not(.active) {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.5);
}

.btn-mode-tab.active {
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

/* 首頁設定區域 */
.lobby-settings-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 22px;
    text-align: left;
}

/* 🌐 真人線上對局面板樣式 */
.lobby-online-box {
    animation: fadeInLobby 0.25s ease-out;
}

.online-mode-desc {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
}

.online-desc-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.online-desc-content h4 {
    margin: 0 0 4px 0;
    font-size: 0.98rem;
    font-weight: 800;
    color: #1e3a8a;
}

.online-desc-content p {
    margin: 0;
    font-size: 0.84rem;
    color: #3b82f6;
    line-height: 1.45;
}

.online-login-required-card {
    text-align: center;
    padding: 14px 10px;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
}

.login-tip-text {
    margin: 0 0 10px 0;
    font-size: 0.88rem;
    color: #64748b;
    font-weight: 600;
}

.btn-online-login {
    display: inline-block;
    padding: 9px 24px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 700;
    border-radius: 20px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transition: all 0.2s ease;
}

.btn-online-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.online-actions-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-online-enter-lobby {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #059669, #047857);
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 800;
    padding: 13px 18px;
    border-radius: 12px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
    transition: all 0.25s ease;
}

.btn-online-enter-lobby:hover {
    background: linear-gradient(135deg, #10b981, #059669);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.4);
}

.lobby-setting-item {
    margin-bottom: 14px;
}

.lobby-setting-item:last-child {
    margin-bottom: 0;
}

.lobby-setting-item label {
    display: block;
    font-size: 0.86rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}

/* 首頁廣告版位 */
.go-lobby-ad-section {
    margin-bottom: 24px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
}

.go-lobby-ad-section .ad-label {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.go-lobby-ad-section .ad-container {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
}

/* 首頁按鈕群 */
.lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-lobby-start {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 14px 20px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
    transition: all 0.25s ease;
}

.btn-lobby-start:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.45);
}

.btn-lobby-leaderboard {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 800;
    padding: 13px 20px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
    transition: all 0.25s ease;
}

.btn-lobby-leaderboard:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.45);
}

.btn-lobby-import {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 800;
    padding: 13px 20px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
    transition: all 0.25s ease;
}

.btn-lobby-import:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.45);
}

/* =========================================================
   🏆 排行榜彈窗 (Leaderboard Modal) 專屬樣式
   ========================================================= */
.go-leaderboard-box {
    max-width: 620px;
    width: 95%;
    max-height: calc(85dvh - env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
}

.leaderboard-filter-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.leaderboard-filter-group .filter-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
    min-width: 60px;
}

.leaderboard-filter-group .btn-group {
    flex: 1;
    display: flex;
    gap: 6px;
}

.leaderboard-filter-group .btn-option {
    flex: 1;
    padding: 7px 6px;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
}

.leaderboard-filter-group .btn-option.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.leaderboard-table-wrapper {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    min-height: 220px;
    max-height: 340px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.leaderboard-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
    padding: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid #e2e8f0;
}

.leaderboard-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.leaderboard-table tr:hover {
    background: #f8fafc;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-weight: 800;
    font-size: 0.85rem;
}

.rank-badge.top-1 { background: #fef3c7; color: #b45309; border: 1.5px solid #f59e0b; }
.rank-badge.top-2 { background: #f1f5f9; color: #475569; border: 1.5px solid #94a3b8; }
.rank-badge.top-3 { background: #ffedd5; color: #9a3412; border: 1.5px solid #ea580c; }
.rank-badge.other { background: transparent; color: #64748b; font-weight: 600; }

.table-loading, .table-empty {
    text-align: center;
    padding: 40px 10px !important;
    color: #64748b;
    font-size: 0.9rem;
}

.leaderboard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    flex-wrap: wrap;
    gap: 8px;
}

.login-tip-link {
    font-size: 0.82rem;
    font-weight: 700;
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s;
}

.login-tip-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

@media (max-width: 480px) {
    .go-lobby-card {
        padding: 24px 18px;
    }
    .lobby-title {
        font-size: 1.75rem;
    }
    .btn-lobby-start {
        font-size: 1.05rem;
        padding: 13px 18px;
    }
    .btn-lobby-leaderboard {
        font-size: 0.95rem;
        padding: 11px 16px;
    }
    .leaderboard-filter-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .leaderboard-filter-group .btn-group {
        width: 100%;
    }
    .go-leaderboard-box {
        padding: 20px 16px 16px 16px;
        max-height: calc(80dvh - env(safe-area-inset-bottom, 0px));
    }
    .leaderboard-table-wrapper {
        max-height: 220px;
    }
    .leaderboard-footer {
        margin-top: 10px;
        padding-bottom: 6px;
    }
}



