/* ================= 夜間模式 (預設 MightPulse Dark Theme) ================= */
        :root {
            --bg-dark: #090b10;
            --nav-bg: rgba(13, 17, 26, 0.88);
            --panel-bg: rgba(18, 23, 35, 0.94);
            --card-sub-bg: rgba(255, 255, 255, 0.035);
            --card-hover-bg: rgba(212, 175, 55, 0.08);
            --input-bg: #0d111a;
            --readonly-bg: #141926;
            --border-subtle: rgba(255, 255, 255, 0.08);
            --border-mid: #2d3748;
            --gold-primary: #d4af37;
            --gold-light: #f3e5ab;
            --gold-dark: #996515;
            --accent-cyan: #00b4d8;
            --k1-blue: #00b4d8;
            --k2-red: #e63946;
            --text-main: #f1f5f9;
            --text-muted: #94a3b8;
            --tab-header-bg: #0d111a;
            --tab-row-odd: rgba(15, 23, 42, 0.55);
            --tab-row-even: rgba(30, 41, 59, 0.35);
            --drawer-bg: rgba(8, 10, 15, 0.96);
        }

        /* ================= 日間模式 (Light Theme) ================= */
        body.light-mode {
            --bg-dark: #f1f5f9;
            --nav-bg: rgba(255, 255, 255, 0.92);
            --panel-bg: rgba(255, 255, 255, 0.98);
            --card-sub-bg: #f8fafc;
            --card-hover-bg: rgba(180, 83, 9, 0.06);
            --input-bg: #ffffff;
            --readonly-bg: #e2e8f0;
            --border-subtle: #e2e8f0;
            --border-mid: #cbd5e1;
            --gold-primary: #b45309;
            --gold-light: #92400e;
            --gold-dark: #d97706;
            --accent-cyan: #0284c7;
            --k1-blue: #0284c7;
            --k2-red: #dc2626;
            --text-main: #0f172a;
            --text-muted: #475569;
            --tab-header-bg: #f8fafc;
            --tab-row-odd: #ffffff;
            --tab-row-even: #f1f5f9;
            --drawer-bg: #f8fafc;
            background-image: 
                radial-gradient(circle at 20% 10%, rgba(2, 132, 199, 0.07) 0%, transparent 40%),
                radial-gradient(circle at 80% 10%, rgba(180, 83, 9, 0.07) 0%, transparent 40%),
                linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%) !important;
        }

        * { box-sizing: border-box; }

        body { 
            font-family: 'Rajdhani', 'Inter', -apple-system, BlinkMacSystemFont, "Microsoft JhengHei", sans-serif; 
            background-color: var(--bg-dark);
            background-image: 
                radial-gradient(circle at 18% 12%, rgba(0, 180, 216, 0.12) 0%, transparent 38%),
                radial-gradient(circle at 82% 12%, rgba(212, 175, 55, 0.1) 0%, transparent 38%),
                linear-gradient(180deg, #090b10 0%, #111622 100%);
            color: var(--text-main);
            margin: 0; 
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            transition: background-color 0.25s, color 0.25s;
        }

        /* ================= 頂部導覽列 (Top Navbar) ================= */
        .top-navbar {
            position: sticky;
            top: 0;
            z-index: 300;
            background: var(--nav-bg);
            backdrop-filter: blur(14px);
            -webkit-backdrop-filter: blur(14px);
            border-bottom: 1px solid rgba(212, 175, 55, 0.28);
            padding: 0 28px;
            height: 68px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 20px;
        }

        .brand-logo {
            display: flex;
            align-items: center;
            gap: 12px;
            text-decoration: none;
            cursor: pointer;
            user-select: none;
        }
        .brand-icon-wrap {
            width: 38px;
            height: 38px;
            border-radius: 8px;
            background: linear-gradient(135deg, rgba(212,175,55,0.25) 0%, rgba(0,180,216,0.2) 100%);
            border: 1px solid var(--gold-primary);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--gold-primary);
            font-size: 18px;
            box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
        }
        .brand-text h2 {
            font-family: 'Cinzel', serif;
            color: var(--gold-primary);
            margin: 0;
            font-size: 20px;
            letter-spacing: 1.5px;
            line-height: 1.1;
        }
        .brand-text span {
            font-size: 11px;
            color: var(--text-muted);
            letter-spacing: 2px;
            text-transform: uppercase;
            font-weight: 700;
            display: block;
        }

        .top-nav-links {
            display: flex;
            align-items: center;
            gap: 8px;
            list-style: none;
            margin: 0;
            padding: 0;
        }
        .top-nav-links li a {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 16px;
            border-radius: 8px;
            color: var(--text-muted);
            text-decoration: none;
            font-weight: 700;
            font-size: 15px;
            border: 1px solid transparent;
            transition: all 0.2s;
        }
        .top-nav-links li a:hover {
            color: var(--text-main);
            background: var(--card-sub-bg);
            border-color: var(--border-subtle);
        }
        .top-nav-links li a.active {
            color: var(--gold-light);
            background: rgba(212, 175, 55, 0.15);
            border-color: rgba(212, 175, 55, 0.45);
            box-shadow: 0 0 14px rgba(212, 175, 55, 0.15);
        }

        .top-nav-actions {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .btn-nav-tool {
            background: var(--card-sub-bg);
            color: var(--text-main);
            border: 1px solid var(--border-mid);
            padding: 6px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-family: inherit;
            font-weight: 700;
            font-size: 13px;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            transition: all 0.2s;
        }
        .btn-nav-tool:hover {
            border-color: var(--gold-primary);
            color: var(--gold-primary);
        }
        .nav-auth-pill {
            font-size: 12px;
            color: var(--text-muted);
            padding: 5px 10px;
            border-radius: 20px;
            background: var(--card-sub-bg);
            border: 1px solid var(--border-subtle);
            white-space: nowrap;
        }

        .mobile-menu-btn {
            display: none;
            background: var(--gold-primary);
            color: #111;
            border: none;
            padding: 7px 11px;
            border-radius: 6px;
            font-size: 16px;
            cursor: pointer;
        }

        /* ================= 主內容容器 ================= */
        .main-content {
            flex-grow: 1;
            width: 100%;
            max-width: 1480px;
            margin: 0 auto;
            padding: 28px 28px 50px 28px;
        }
        .view-section { display: none; }
        .view-section.active { display: block; animation: fadeIn 0.2s ease; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

        /* ================= MightPulse.com 風格首頁設計 ================= */
        .mp-hero-section {
            text-align: center;
            padding: 32px 20px 28px 20px;
            margin-bottom: 26px;
            border-radius: 16px;
            background: 
                radial-gradient(circle at 50% 0%, rgba(0, 180, 216, 0.16) 0%, rgba(212, 175, 55, 0.08) 45%, transparent 75%),
                var(--panel-bg);
            border: 1px solid rgba(212, 175, 55, 0.35);
            box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
        }
        .mp-pulse-badge {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 5px 14px;
            border-radius: 999px;
            background: rgba(0, 180, 216, 0.12);
            border: 1px solid rgba(0, 180, 216, 0.4);
            color: var(--accent-cyan);
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 2px;
            text-transform: uppercase;
            margin-bottom: 12px;
        }
        .mp-hero-section h1 {
            font-family: 'Cinzel', "Microsoft JhengHei", serif;
            font-size: 38px;
            margin: 0 0 8px 0;
            color: var(--gold-primary);
            letter-spacing: 2px;
        }
        .mp-hero-section p {
            color: var(--text-muted);
            font-size: 16px;
            max-width: 680px;
            margin: 0 auto 24px auto;
            font-weight: 500;
        }

        .mp-search-omnibox {
            max-width: 720px;
            margin: 0 auto;
            display: flex;
            align-items: center;
            background: var(--input-bg);
            border: 2px solid rgba(212, 175, 55, 0.5);
            border-radius: 12px;
            padding: 6px 8px 6px 18px;
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
            transition: border-color 0.2s, box-shadow 0.2s;
        }
        .mp-search-omnibox:focus-within {
            border-color: var(--accent-cyan);
            box-shadow: 0 0 20px rgba(0, 180, 216, 0.25);
        }
        .mp-search-omnibox i.search-icon {
            color: var(--gold-primary);
            font-size: 18px;
            margin-right: 12px;
        }
        .mp-search-omnibox input {
            flex: 1;
            border: none !important;
            background: transparent !important;
            color: var(--text-main);
            font-size: 17px;
            font-weight: 600;
            padding: 8px 0;
            outline: none;
        }

        /* 首頁搜尋結果：基本資料卡片網格 */
        .search-basic-results-wrap {
            max-width: 960px;
            margin: 18px auto 0 auto;
            text-align: left;
            display: none;
        }
        .search-basic-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
            gap: 12px;
            margin-top: 10px;
        }
        .gov-basic-card {
            background: var(--card-sub-bg);
            border: 1px solid var(--border-mid);
            border-left: 4px solid var(--gold-primary);
            border-radius: 10px;
            padding: 14px 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            transition: all 0.2s;
        }
        .gov-basic-card:hover {
            transform: translateY(-2px);
            background: var(--card-hover-bg);
            border-color: var(--gold-primary);
            box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
        }
        .gov-basic-left {
            display: flex;
            align-items: center;
            gap: 12px;
            min-width: 0;
        }
        .gov-avatar-circle {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: linear-gradient(135deg, rgba(212,175,55,0.2), rgba(0,180,216,0.2));
            border: 1px solid var(--gold-primary);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--gold-primary);
            font-size: 18px;
            flex-shrink: 0;
        }
        .gov-basic-info {
            min-width: 0;
        }
        .gov-basic-name {
            font-weight: 800;
            font-size: 17px;
            color: var(--text-main);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .gov-basic-meta {
            font-size: 13px;
            color: var(--text-muted);
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 2px;
        }
        .gov-basic-right {
            text-align: right;
            flex-shrink: 0;
        }
        .gov-basic-power {
            font-size: 16px;
            font-weight: 800;
            color: var(--gold-primary);
        }
        .gov-basic-view {
            font-size: 12px;
            color: var(--accent-cyan);
            font-weight: 700;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            margin-top: 3px;
        }

        /* MightPulse 風格首頁 4 大數據統計卡 */
        .mp-kpi-strip {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 18px;
            margin-bottom: 24px;
        }
        .mp-kpi-card {
            background: var(--panel-bg);
            border: 1px solid var(--border-subtle);
            border-top: 3px solid var(--gold-primary);
            border-radius: 12px;
            padding: 16px 20px;
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .mp-kpi-card.cyan-top { border-top-color: var(--accent-cyan); }
        .mp-kpi-label {
            font-size: 12px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: 700;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .mp-kpi-value {
            font-size: 26px;
            font-weight: 800;
            color: var(--text-main);
        }
        .mp-kpi-sub {
            font-size: 13px;
            color: var(--gold-primary);
            font-weight: 600;
        }

        /* 首頁排行榜分類切換膠囊按鈕列 */
        .board-pills-bar {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 16px;
        }
        .board-pill {
            background: var(--card-sub-bg);
            color: var(--text-muted);
            border: 1px solid var(--border-mid);
            padding: 6px 14px;
            border-radius: 999px;
            font-family: inherit;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
        }
        .board-pill:hover {
            color: var(--text-main);
            border-color: var(--gold-primary);
        }
        .board-pill.active {
            background: rgba(212, 175, 55, 0.22);
            color: var(--gold-light);
            border-color: var(--gold-primary);
            box-shadow: 0 0 12px rgba(212, 175, 55, 0.18);
        }

        /* ================= MightPulse.com /kingdom/302 風格排行榜卡片列表 ================= */
        .mp-leaderboard-head {
            display: grid;
            grid-template-columns: 60px 1.8fr 1.1fr 110px 1.2fr 20px;
            gap: 12px;
            padding: 10px 16px;
            font-size: 12px;
            font-weight: 800;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1px;
            border-bottom: 1px solid var(--border-subtle);
            margin-bottom: 8px;
        }
        .mp-alliance-head {
            display: grid;
            grid-template-columns: 60px 1.8fr 1.2fr;
            gap: 12px;
            padding: 10px 16px;
            font-size: 12px;
            font-weight: 800;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1px;
            border-bottom: 1px solid var(--border-subtle);
            margin-bottom: 8px;
        }
        .mp-board-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .mp-board-row {
            display: grid;
            grid-template-columns: 60px 1.8fr 1.1fr 110px 1.2fr 20px;
            gap: 12px;
            align-items: center;
            padding: 11px 16px;
            background: var(--card-sub-bg);
            border: 1px solid var(--border-subtle);
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.18s ease;
        }
        .mp-board-row:hover {
            background: var(--card-hover-bg);
            border-color: rgba(212, 175, 55, 0.45);
            transform: translateX(3px);
        }
        .mp-board-row.top-1-row {
            background: linear-gradient(90deg, rgba(234, 179, 8, 0.14) 0%, var(--card-sub-bg) 60%);
            border-color: rgba(234, 179, 8, 0.45);
        }
        .mp-board-row.top-2-row {
            background: linear-gradient(90deg, rgba(148, 163, 184, 0.14) 0%, var(--card-sub-bg) 60%);
            border-color: rgba(148, 163, 184, 0.4);
        }
        .mp-board-row.top-3-row {
            background: linear-gradient(90deg, rgba(205, 127, 50, 0.14) 0%, var(--card-sub-bg) 60%);
            border-color: rgba(205, 127, 50, 0.4);
        }

        .mp-ally-row {
            display: grid;
            grid-template-columns: 60px 1.8fr 1.2fr;
            gap: 12px;
            align-items: center;
            padding: 12px 16px;
            background: var(--card-sub-bg);
            border: 1px solid var(--border-subtle);
            border-radius: 10px;
            transition: all 0.18s ease;
        }
        .mp-ally-row:hover {
            border-color: rgba(0, 180, 216, 0.45);
        }

        .mp-rank-box {
            width: 36px;
            height: 32px;
            border-radius: 7px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-weight: 800;
            font-size: 14px;
            background: var(--input-bg);
            border: 1px solid var(--border-mid);
            color: var(--text-muted);
        }
        .mp-rank-box.r-1 { background: rgba(234, 179, 8, 0.2); border-color: #eab308; color: #eab308; box-shadow: 0 0 10px rgba(234,179,8,0.25); }
        .mp-rank-box.r-2 { background: rgba(226, 232, 240, 0.15); border-color: #cbd5e1; color: #e2e8f0; }
        .mp-rank-box.r-3 { background: rgba(205, 127, 50, 0.2); border-color: #cd7f32; color: #cd7f32; }

        .mp-gov-cell {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 0;
        }
        .mp-gov-avatar {
            width: 34px;
            height: 34px;
            border-radius: 8px;
            background: rgba(212, 175, 55, 0.12);
            border: 1px solid rgba(212, 175, 55, 0.35);
            color: var(--gold-primary);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            flex-shrink: 0;
        }
        .mp-gov-name {
            font-weight: 800;
            font-size: 16px;
            color: var(--text-main);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .mp-ally-pill {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 3px 10px;
            border-radius: 6px;
            font-size: 13px;
            font-weight: 700;
            background: rgba(0, 180, 216, 0.1);
            border: 1px solid rgba(0, 180, 216, 0.3);
            color: var(--accent-cyan);
            max-width: 100%;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* TG 1 ~ TG 10 真金徽章與 TC 等級標籤 */
        .mp-tc-pill {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            padding: 3px 10px;
            border-radius: 6px;
            font-size: 13px;
            font-weight: 800;
            background: rgba(148, 163, 184, 0.12);
            border: 1px solid var(--border-mid);
            color: var(--text-muted);
            min-width: 68px;
        }
        .mp-tc-pill.tg-badge {
            background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(180, 83, 9, 0.25) 100%);
            border: 1px solid var(--gold-primary);
            color: var(--gold-light);
            box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
        }
        .mp-tc-pill.tg-max {
            background: linear-gradient(135deg, rgba(239, 68, 68, 0.28) 0%, rgba(212, 175, 55, 0.3) 100%);
            border: 1px solid #f59e0b;
            color: #fde047;
            box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
        }

        .mp-power-cell {
            text-align: right;
            font-variant-numeric: tabular-nums;
        }
        .mp-power-main {
            font-size: 16px;
            font-weight: 800;
            color: var(--text-main);
            font-variant-numeric: tabular-nums;
            font-feature-settings: "tnum" 1;
        }
        /* 風格 3：所有榜單與表格數字等寬對齊 */
        .tabulator, .mp-board-row, .mp-kpi-card, .rank-prob-table, .mp-leaderboard-head {
            font-variant-numeric: tabular-nums;
        }

        /* 風格 5：整列可點的視覺提示 */
        .mp-row-go {
            font-size: 12px;
            color: var(--text-muted);
            opacity: 0.35;
            justify-self: end;
            transition: opacity 0.18s ease, transform 0.18s ease, color 0.18s ease;
        }
        .mp-board-row:hover .mp-row-go,
        .mp-board-row:focus-visible .mp-row-go {
            opacity: 1;
            color: var(--gold-primary);
            transform: translateX(3px);
        }

        /* 資料時間：醒目徽章 (UTC) */
        .asof-chip {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 6px 14px;
            border-radius: 999px;
            font-size: 14px;
            font-weight: 800;
            color: var(--accent-cyan);
            background: rgba(0, 180, 216, 0.12);
            border: 1px solid rgba(0, 180, 216, 0.45);
            font-variant-numeric: tabular-nums;
            letter-spacing: 0.2px;
        }
        .asof-chip i { font-size: 14px; }
        .asof-row { display: flex; justify-content: flex-end; margin: -2px 0 12px; }

        .mp-ally-bar-track {
            width: 100%;
            height: 5px;
            background: var(--input-bg);
            border-radius: 999px;
            overflow: hidden;
            margin-top: 5px;
        }
        .mp-ally-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--accent-cyan), var(--gold-primary));
            border-radius: 999px;
        }

        .mp-show-more-wrap {
            margin-top: 14px;
            text-align: center;
        }
        .btn-mp-more {
            width: 100%;
            padding: 11px 16px;
            background: var(--card-sub-bg);
            color: var(--gold-primary);
            border: 1px dashed var(--gold-primary);
            border-radius: 8px;
            font-family: inherit;
            font-size: 14px;
            font-weight: 800;
            cursor: pointer;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        .btn-mp-more:hover {
            background: rgba(212, 175, 55, 0.15);
            color: var(--gold-light);
        }

        @media (max-width: 720px) {
            .mp-leaderboard-head { display: none; }
            .mp-board-row {
                grid-template-columns: 42px minmax(0, 1fr) auto 14px;
                grid-template-areas:
                    "rank gov  power go"
                    "rank meta power go";
                row-gap: 6px;
                column-gap: 10px;
                padding: 12px 12px;
            }
            .mp-board-row > .mp-rank-col { grid-area: rank; align-self: center; }
            .mp-board-row > .mp-gov-cell { grid-area: gov; }
            .mp-board-row > .mp-power-cell { grid-area: power; align-self: center; }
            .mp-board-row > .mp-row-go { grid-area: go; align-self: center; opacity: 0.5; }
            /* 聯盟與 TC 並排收在名稱下方，騰出空間給分數 */
            .mp-board-row > .mp-ally-col,
            .mp-board-row > .mp-tc-col { grid-area: meta; min-width: 0; }
            .mp-board-row > .mp-ally-col { justify-self: start; max-width: 55%; }
            .mp-board-row > .mp-tc-col { justify-self: end; text-align: right !important; }
            .asof-row { justify-content: center; }
            .asof-chip { font-size: 12px; padding: 5px 12px; border-radius: 14px; text-align: center; justify-content: center; }
        }

        /* ================= 個人資料專頁 (Governor Profile Page) ================= */
        .profile-hero-banner {
            background: var(--panel-bg);
            border: 1px solid rgba(212, 175, 55, 0.45);
            border-radius: 14px;
            padding: 24px 28px;
            margin-bottom: 24px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 20px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
        }
        .profile-identity {
            display: flex;
            align-items: center;
            gap: 20px;
            flex-wrap: wrap;
        }
        .profile-avatar-lg {
            width: 76px;
            height: 76px;
            border-radius: 16px;
            background: linear-gradient(135deg, rgba(212,175,55,0.28), rgba(0,180,216,0.25));
            border: 2px solid var(--gold-primary);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 32px;
            color: var(--gold-primary);
            box-shadow: 0 0 20px rgba(212, 175, 55, 0.25);
        }
        .profile-badges-row {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 8px;
        }
        .p-badge {
            padding: 4px 11px;
            border-radius: 6px;
            font-size: 13px;
            font-weight: 700;
            background: var(--card-sub-bg);
            border: 1px solid var(--border-mid);
            color: var(--text-main);
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }
        .p-badge.gold { border-color: var(--gold-primary); color: var(--gold-light); background: rgba(212,175,55,0.12); }
        .p-badge.cyan { border-color: var(--accent-cyan); color: var(--accent-cyan); background: rgba(0,180,216,0.12); }

        .profile-metrics-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 16px;
            margin-bottom: 24px;
        }
        .profile-stat-box {
            background: var(--panel-bg);
            border: 1px solid var(--border-subtle);
            border-left: 4px solid var(--gold-primary);
            border-radius: 10px;
            padding: 16px 18px;
            box-shadow: 0 4px 16px rgba(0,0,0,0.2);
        }
        .profile-stat-box .ps-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 13px;
            color: var(--text-muted);
            text-transform: uppercase;
            font-weight: 700;
        }
        .profile-stat-box .ps-rank {
            background: rgba(212, 175, 55, 0.18);
            color: var(--gold-primary);
            padding: 1px 7px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: 800;
        }
        .profile-stat-box .ps-val {
            font-size: 24px;
            font-weight: 800;
            color: var(--text-main);
            margin-top: 6px;
        }
        .profile-stat-box .ps-exact {
            font-size: 12px;
            color: var(--text-muted);
            margin-top: 2px;
        }

        /* ================= 通用標題與面板 ================= */
        .header-banner { text-align: center; margin-bottom: 22px; }
        .header-banner h1 {
            font-family: 'Cinzel', "Microsoft JhengHei", serif;
            font-size: 32px;
            margin: 0;
            color: var(--gold-primary);
            letter-spacing: 2px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
        }
        .header-banner p { margin: 5px 0 0; color: var(--text-muted); font-size: 14px; letter-spacing: 2px; text-transform: uppercase; font-weight: 600; }

        .panel-card {
            background: var(--panel-bg);
            padding: 20px 24px;
            border-radius: 12px;
            border: 1px solid rgba(212, 175, 55, 0.32);
            box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
            margin-bottom: 24px;
        }
        .panel-title {
            font-family: 'Cinzel', "Microsoft JhengHei", serif;
            font-size: 19px;
            color: var(--gold-light);
            margin: 0 0 15px 0;
            padding-bottom: 10px;
            border-bottom: 1px solid rgba(212, 175, 55, 0.22);
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 10px;
        }

        .btn-battle { 
            padding: 9px 20px; 
            font-family: 'Cinzel', "Microsoft JhengHei", serif;
            font-size: 14px;
            font-weight: 800;
            background: linear-gradient(180deg, #e5c158 0%, #b8860b 100%); 
            color: #111; 
            border: 1px solid #fff3b0; 
            border-radius: 8px; 
            cursor: pointer; 
            box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: all 0.2s;
            text-decoration: none;
        }
        .btn-battle:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(212, 175, 55, 0.45); }
        .btn-battle:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

        .btn-copy-link {
            background: rgba(0, 180, 216, 0.14);
            color: var(--accent-cyan);
            border: 1px solid var(--accent-cyan);
            padding: 6px 12px;
            border-radius: 6px;
            font-family: inherit;
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            transition: all 0.2s;
        }
        .btn-copy-link:hover { background: var(--accent-cyan); color: #fff; }

        .super-admin-banner {
            background: rgba(212, 175, 55, 0.12);
            border: 1px dashed var(--gold-primary);
            padding: 10px 16px;
            border-radius: 8px;
            margin-bottom: 18px;
            font-size: 14px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 10px;
        }

        /* ================= 雙王國對戰與戰術工具列 ================= */
        .input-group { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--border-subtle); }
        .kingdom-input-box { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: 6px; font-weight: 700; font-size: 16px; }
        .k1-box { background: rgba(0, 180, 216, 0.12); border: 1px solid var(--k1-blue); color: var(--k1-blue); }
        .k2-box { background: rgba(230, 57, 70, 0.12); border: 1px solid var(--k2-red); color: var(--k2-red); }
        .limit-box { background: var(--card-sub-bg); border: 1px solid var(--border-mid); }
        .vs-badge { font-family: 'Cinzel', serif; font-size: 20px; font-weight: 800; color: var(--gold-primary); }

        input[type="number"], input[type="text"], select {
            padding: 7px 10px;
            background: var(--input-bg);
            border: 1px solid var(--gold-dark);
            color: var(--text-main);
            font-family: inherit;
            font-size: 16px;
            font-weight: 700;
            border-radius: 5px;
        }
        .kingdom-input-box input[type="number"] { width: 78px; text-align: center; }
        input::placeholder { color: var(--text-muted); opacity: 0.65; font-weight: 500; font-size: 14px; }

        .tactical-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 0; border-bottom: 1px solid var(--border-subtle); }
        .toolbar-section { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
        .toolbar-label { font-weight: 700; color: var(--gold-primary); text-transform: uppercase; font-size: 14px; margin-right: 4px; }

        .btn-preset, .btn-layout, .btn-visual {
            background: var(--card-sub-bg);
            color: var(--text-main);
            border: 1px solid var(--border-mid);
            padding: 6px 13px;
            border-radius: 6px;
            cursor: pointer;
            font-family: inherit;
            font-weight: 700;
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: all 0.2s;
        }
        .btn-preset:hover, .btn-layout:hover, .btn-visual:hover { border-color: var(--gold-primary); }
        .btn-preset.active, .btn-layout.active, .btn-visual.active {
            background: rgba(212, 175, 55, 0.22);
            border-color: var(--gold-primary);
            color: var(--gold-light);
        }

        .checkbox-group { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding-top: 15px; font-size: 15px; }
        .cb-label { display: flex; align-items: center; gap: 6px; cursor: pointer; background: var(--card-sub-bg); border: 1px solid var(--border-mid); padding: 5px 12px; border-radius: 20px; font-weight: 600; }
        .cb-label:has(input:checked) { background: rgba(212, 175, 55, 0.2); border-color: var(--gold-primary); color: var(--gold-light); }

        /* Chart.js 分析面板 */
        .analytics-dashboard {
            background: var(--panel-bg);
            border: 1px solid rgba(212, 175, 55, 0.5);
            border-radius: 10px;
            padding: 20px;
            margin-bottom: 25px;
            box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
            display: none;
        }
        .charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
        .chart-box { background: var(--card-sub-bg); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 15px; }
        .chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
        .chart-title { font-size: 15px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
        .chart-controls { display: flex; gap: 5px; flex-wrap: wrap; }
        .btn-chart-toggle { background: var(--input-bg); color: var(--text-muted); border: 1px solid var(--border-mid); padding: 4px 10px; border-radius: 4px; font-size: 12px; font-family: inherit; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 4px; }
        .btn-chart-toggle.active { background: rgba(212, 175, 55, 0.22); border-color: var(--gold-primary); color: var(--gold-light); }

        /* 雙表格與展開抽屜 */
        .tables-wrapper { display: flex; gap: 20px; flex-direction: row; }
        .tables-wrapper.stacked-mode { flex-direction: column; }
        .kingdom-table-container { flex: 1; min-width: 0; background: var(--panel-bg); padding: 18px; border-radius: 10px; border: 1px solid var(--border-subtle); }
        .k1-panel { border-top: 3px solid var(--k1-blue); }
        .k2-panel { border-top: 3px solid var(--k2-red); }
        .panel-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-subtle); padding-bottom: 8px; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
        .k1-panel h2 { font-family: 'Cinzel', serif; margin: 0; color: var(--k1-blue); font-size: 21px; }
        .k2-panel h2 { font-family: 'Cinzel', serif; margin: 0; color: var(--k2-red); font-size: 21px; }
        .hint-badge { font-size: 13px; color: var(--text-muted); font-weight: 600; display: flex; align-items: center; gap: 5px; }

        .tabulator { background-color: transparent !important; border: 1px solid var(--border-subtle) !important; font-size: 15px; }
        .tabulator .tabulator-header { background-color: var(--tab-header-bg) !important; border-bottom: 2px solid var(--gold-dark) !important; color: var(--gold-light) !important; font-weight: 700; }
        .tabulator .tabulator-header .tabulator-col { background-color: var(--tab-header-bg) !important; border-right: 1px solid var(--border-subtle) !important; }
        .tabulator-row { background-color: var(--tab-row-odd) !important; color: var(--text-main) !important; border-bottom: 1px solid var(--border-subtle) !important; cursor: pointer; }
        .tabulator-row.tabulator-row-even { background-color: var(--tab-row-even) !important; }
        .tabulator-row:hover { background-color: rgba(212, 175, 55, 0.18) !important; }

        .player-detail-drawer { display: none; background: var(--drawer-bg); border-top: 1px dashed var(--gold-primary); border-bottom: 2px solid var(--gold-dark); padding: 16px 18px; cursor: default; }
        .player-detail-drawer.open { display: block; }
        .drawer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 10px; margin-bottom: 16px; }
        .drawer-card { background: var(--card-sub-bg); border: 1px solid var(--border-subtle); border-left: 3px solid var(--gold-primary); padding: 7px 10px; border-radius: 4px; }
        .drawer-card .d-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
        .drawer-card .d-val { font-size: 16px; font-weight: 700; color: var(--text-main); margin-top: 2px; }
        
        /* ================= 英雄陣容卡片 ================= */
        .heroes-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 16px;
        }
        .mp-hero-card {
            background: var(--panel-bg);
            border: 1px solid var(--border-subtle);
            border-top: 4px solid var(--gold-primary); /* 修正為網站風格的金色邊框 */
            border-radius: 12px;
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 16px;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
        }

        /* 頂部大頭貼與名稱 */
        .hero-top-row { display: flex; gap: 14px; align-items: flex-start; }
        .hero-avatar-box { width: 72px; height: 72px; border-radius: 12px; background: var(--input-bg); border: 1px solid var(--border-mid); overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
        .hero-avatar-box img { width: 100%; height: 100%; object-fit: cover; }
        .hero-title-area { display: flex; flex-direction: column; gap: 8px; }
        .hero-name-lg { font-size: 19px; font-weight: 900; color: var(--text-main); line-height: 1.1; }
        
        /* 星星容器與精確的 clip-path 裁切效果 */
        .hero-stars-box {
            display: inline-flex;
            gap: 2px;
            background: var(--input-bg);
            border: 1px solid var(--border-mid);
            padding: 5px 8px;
            border-radius: 6px;
            align-items: center;
        }
        .star-wrapper {
            position: relative;
            display: inline-block;
            width: 14px;
            height: 14px;
        }
        /* 灰底星 */
        .star-bg { color: #64748b; position: absolute; left: 0; top: 0; font-size: 13px; }
        /* 金星填滿 (使用 clip-path 從右側精準切掉不滿的部分) */
        .star-fill { color: #eab308; position: absolute; left: 0; top: 0; font-size: 13px; overflow: hidden; }

        .hero-details-list { display: grid; grid-template-columns: 1fr auto; row-gap: 6px; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border-subtle); padding-bottom: 16px; }
        .hero-details-list .val { font-weight: 800; color: var(--text-main); }
        .hero-gear-section { display: flex; flex-direction: column; gap: 10px; }
        .hero-gear-title { font-size: 12px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
        .hero-gear-wrap { display: flex; flex-wrap: wrap; gap: 10px; }

        /* 裝備圖示框：底色只分黃色與紅色(神話) */
        .mp-gear-item {
            position: relative;
            width: 60px;
            height: 60px;
            border-radius: 8px;
            background: linear-gradient(135deg, #fcd34d 0%, #d97706 100%); /* 一般裝備黃底 */
            border: 1px solid #b45309;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .mp-gear-item.red-gear {
            background: linear-gradient(135deg, #f87171 0%, #b91c1c 100%); /* 神話裝備紅底 */
            border: 1px solid #991b1b;
        }
        .mp-gear-item img { width: 80%; height: 80%; object-fit: contain; z-index: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5)); }

        /* 左上角：兵種圖示 */
        .gear-troop-icon {
            position: absolute;
            top: -4px;
            left: -4px;
            width: 18px;
            height: 18px;
            background: #475569;
            border: 1px solid #94a3b8;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #f8fafc;
            font-size: 10px;
            z-index: 3;
            box-shadow: 0 1px 3px rgba(0,0,0,0.5);
        }
        
        /* 右上角強化標籤與顏色級距 (依照您的指示: 1-100 為黃色) */
        .gear-enh-lbl {
            position: absolute;
            top: 2px;
            right: 2px;
            color: #ffffff;
            font-size: 10px;
            font-weight: 900;
            z-index: 3;
            padding: 1px 4px;
            border-radius: 4px;
            line-height: 1.1;
            box-shadow: 0 1px 2px rgba(0,0,0,0.5);
        }
        .enh-base { background-color: #c48a14; } /* 100 包含以下 */
        .enh-119 { background-color: #3b82f6; } /* 101-119 藍 */
        .enh-139 { background-color: #10b981; } /* 120-139 綠 */
        .enh-159 { background-color: #a855f7; } /* 140-159 紫 */
        .enh-179 { background-color: #ec4899; } /* 160-179 粉 */
        .enh-199 { background-color: #f97316; } /* 180-199 橘 */
        .enh-200 { background-color: #ef4444; } /* 200 紅 */

        /* 底部：精煉/專武等級 */
        .gear-lv-lbl {
            position: absolute;
            bottom: 2px;
            left: 0;
            right: 0;
            text-align: center;
            color: #ffffff;
            font-size: 11px;
            font-weight: 900;
            z-index: 3;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.9);
        }

        .gov-cell-wrap { display: flex; align-items: center; gap: 6px; }
        .expand-caret { color: var(--gold-primary); font-size: 12px; transition: transform 0.2s; opacity: 0.7; }
        .row-expanded .expand-caret { transform: rotate(90deg); opacity: 1; }

        .rank-1 { color: #eab308; font-weight: 800; font-size: 16px; }
        .rank-2 { color: #94a3b8; font-weight: 800; font-size: 16px; }
        .rank-3 { color: #cd7f32; font-weight: 800; font-size: 16px; }

        /* ================= 後勤 D:H:M 表單樣式 ================= */
        .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
        .form-field { display: flex; flex-direction: column; gap: 6px; background: var(--card-sub-bg); border: 1px solid var(--border-subtle); padding: 12px 14px; border-radius: 8px; }
        .form-field label { font-size: 14px; font-weight: 700; color: var(--text-main); display: flex; justify-content: space-between; align-items: center; }
        
        .dhm-row {
            display: grid;
            grid-template-columns: 1fr auto 1fr auto 1fr;
            gap: 6px;
            align-items: center;
        }
        .dhm-unit {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }
        .dhm-unit input {
            width: 100%;
            text-align: center;
            padding: 6px 4px;
            font-size: 15px;
        }
        .dhm-unit span {
            font-size: 11px;
            color: var(--text-muted);
            text-align: center;
            font-weight: 700;
            text-transform: uppercase;
        }
        .dhm-sep {
            font-weight: 800;
            font-size: 18px;
            color: var(--gold-primary);
            padding-bottom: 14px;
        }
        .mins-badge {
            font-size: 12px;
            color: var(--k1-blue);
            font-weight: 700;
        }

        .score-preview-bar {
            background: rgba(212, 175, 55, 0.12);
            border: 1px solid var(--gold-primary);
            border-radius: 8px;
            padding: 14px 18px;
            margin: 18px 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 12px;
        }
        .data-table { width: 100%; border-collapse: collapse; font-size: 15px; }
        .data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); text-align: left; }
        .data-table th { color: var(--gold-light); background: var(--tab-header-bg); border-bottom: 2px solid var(--gold-dark); }

        .btn-del-row {
            background: rgba(239, 68, 68, 0.15);
            color: #ef4444;
            border: 1px solid rgba(239, 68, 68, 0.4);
            padding: 3px 9px;
            border-radius: 4px;
            cursor: pointer;
            font-family: inherit;
            font-weight: 700;
            font-size: 12px;
            transition: all 0.2s;
        }
        .btn-del-row:hover { background: #ef4444; color: #fff; }

        /* ================= RWD 響應式設計 ================= */
        @media (max-width: 1080px) {
            .top-navbar {
                padding: 10px 16px;
                height: auto;
                flex-wrap: wrap;
            }
            .mobile-menu-btn { display: inline-flex; }
            .top-nav-links {
                display: none;
                width: 100%;
                flex-direction: column;
                align-items: stretch;
                padding-top: 10px;
                border-top: 1px solid var(--border-subtle);
                order: 4;
            }
            .top-nav-links.open { display: flex; }
            .mp-kpi-strip { grid-template-columns: repeat(2, 1fr); }
            .charts-grid, .form-grid { grid-template-columns: 1fr; }
            .tables-wrapper { flex-direction: column !important; }
            .tactical-toolbar { flex-direction: column; align-items: flex-start; }
            .main-content { padding: 18px 12px 40px 12px; }
        }
        @media (max-width: 600px) {
            .mp-kpi-strip { grid-template-columns: 1fr; }
            .mp-hero-section h1 { font-size: 26px; }
            .nav-auth-pill { display: none; }
        }

        /* ===== Toast 通知 / 進度條 / 骨架屏 / 手機欄位面板 ===== */
        #toastHost { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 99999; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
        .toast { pointer-events: auto; background: #1e293b; color: #f1f5f9; border: 1px solid var(--border-mid); border-left: 5px solid #ef4444; border-radius: 8px; padding: 11px 14px; font-weight: 600; font-size: 14px; white-space: pre-line; box-shadow: 0 8px 24px rgba(0,0,0,0.3); cursor: pointer; animation: toastIn .2s ease-out; }
        body.light-mode .toast { background: #ffffff; color: #0f172a; }
        .toast.success { border-left-color: #10b981; }
        .toast.info { border-left-color: var(--gold-primary); }
        @keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
        .fd-progress { height: 8px; border-radius: 6px; background: var(--card-sub-bg); border: 1px solid var(--border-mid); overflow: hidden; margin: 10px auto 0; max-width: 420px; }
        .fd-progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dark), var(--gold-primary)); transition: width .4s ease; }
        .notice-bar { display: none; border-radius: 8px; padding: 9px 12px; margin-bottom: 12px; font-size: 13px; font-weight: 600; background: var(--card-sub-bg); border: 1px solid var(--border-mid); line-height: 1.5; }
        .notice-bar.warn { border-color: #f59e0b; background: rgba(245,158,11,0.12); }
        .skeleton-row { height: 54px; border-radius: 8px; margin: 8px 0; background: linear-gradient(90deg, var(--card-sub-bg) 25%, rgba(148,163,184,0.25) 37%, var(--card-sub-bg) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
        @keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
        .empty-state { text-align: center; padding: 26px 12px; color: var(--text-muted); font-weight: 700; }
        details.col-picker { margin-top: 12px; }
        details.col-picker > summary { cursor: pointer; font-weight: 700; color: var(--gold-primary); list-style: none; display: flex; align-items: center; gap: 6px; padding: 6px 2px; user-select: none; }
        details.col-picker > summary::-webkit-details-marker { display: none; }
        details.col-picker > summary::after { content: '▾'; margin-left: auto; transition: transform .2s; }
        details.col-picker[open] > summary::after { transform: rotate(180deg); }
        details.col-picker > .checkbox-group { padding-top: 6px; }
        .swipe-hint { display: none; text-align: center; font-size: 12px; color: var(--text-muted); font-weight: 600; margin: 4px 0 6px; }
        @media (max-width: 600px) {
            .header-banner h1 { font-size: 24px; line-height: 1.2; }
            .header-banner p { font-size: 11px; letter-spacing: 1px; }
            .input-group { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
            .input-group .kingdom-input-box { flex-direction: column; align-items: stretch; gap: 4px; padding: 7px 10px; font-size: 13px; }
            .input-group .kingdom-input-box input[type="number"] { width: 100%; box-sizing: border-box; }
            .input-group .kingdom-input-box.limit-box { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
            .input-group .kingdom-input-box.limit-box input, .input-group .kingdom-input-box.limit-box select { flex: 1; width: auto; min-width: 0; }
            .input-group .btn-battle { grid-column: 1 / -1; width: 100%; justify-content: center; }
            details.col-picker > .checkbox-group { display: grid; grid-template-columns: 1fr 1fr; justify-content: stretch; gap: 8px; }
            details.col-picker .cb-label { border-radius: 10px; font-size: 13px; padding: 7px 10px; }
            .tabulator { font-size: 13px; }
            .tabulator .tabulator-cell, .tabulator .tabulator-col .tabulator-col-content { padding-left: 6px; padding-right: 6px; }
            .swipe-hint { display: block; }
        }
    

/* ===== 手機卡片式排行榜 (<=600px 取代表格) ===== */
.mcards { display: none; flex-direction: column; gap: 10px; }
.pcard { background: var(--card-sub-bg); border: 1px solid var(--border-mid); border-radius: 12px; overflow: hidden; }
.pcard-head { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 12px; cursor: pointer; }
.pcard-head:focus-visible { outline: 2px solid var(--gold-primary); outline-offset: -2px; }
.pcard-top { display: flex; align-items: center; gap: 10px; }
.pavatar { position: relative; width: 48px; height: 48px; flex: none; }
.pavatar-circle { position: relative; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; box-sizing: border-box; border: 2px solid var(--border-mid); background: var(--card-bg, rgba(30,41,59,0.6)); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 20px; }
.pavatar-circle img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.prank { position: absolute; left: -5px; bottom: -5px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--panel-bg, #121b2e); box-sizing: border-box; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; background: #1c2a45; color: #e2e8f0; }
.prank.r1 { background: #d4af37; color: #1a1405; } .prank.r2 { background: #cbd5e1; color: #111827; } .prank.r3 { background: #c98a4b; color: #1a1005; }
.pinfo { flex: 1; min-width: 0; }
.pname { font-weight: 700; font-size: 18px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-main); }
.pally { font-size: 13px; font-weight: 600; color: var(--accent-cyan, #38bdf8); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ppill { font-weight: 800; font-size: 13px; color: var(--gold-primary); border: 1px solid var(--gold-dark); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.pstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.pstat { border-radius: 8px; padding: 7px 8px; min-width: 0; border: 1px solid var(--border-mid); background: var(--input-bg); }
.pstat.base { border-color: var(--gold-dark); background: rgba(212,175,55,0.12); }
.pstat-n { font-size: 11px; color: var(--text-muted); font-weight: 600; line-height: 1.2; }
.pstat-v { font-size: 16px; font-weight: 700; margin-top: 2px; line-height: 1.2; color: var(--text-main); white-space: nowrap; }
.pcard-detail { display: none; border-top: 1px dashed var(--border-mid); padding: 10px 12px 12px; }
.pcard.open .pcard-detail { display: block; }
.pdetail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px 14px; }
.pdetail-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.pdetail-row span:first-child { color: var(--text-muted); }
.pdetail-row span:last-child { font-weight: 700; color: var(--text-main); white-space: nowrap; }
.pdetail-btn { margin-top: 10px; width: 100%; min-height: 44px; border-radius: 8px; border: 1px solid var(--gold-dark); background: rgba(212,175,55,0.15); color: var(--gold-primary); font-weight: 700; font-size: 15px; cursor: pointer; font-family: inherit; }
.swipe-hint { display: none !important; }
@media (max-width: 600px) {
    .mcards { display: flex; }
    #tableFlamedragon, #tableKid1, #tableKid2 { display: none; }
}

/* ===== 卡片內的英雄陣容 (精簡版) ===== */
.phero-block { margin-top: 14px; }
.phero-title { font-weight: 700; color: var(--gold-primary); font-size: 14px; margin-bottom: 8px; }
.phero-slot { display: flex; flex-direction: column; gap: 8px; }
.phero-hint { font-size: 13px; color: var(--text-muted); text-align: center; padding: 8px 0; }
.phero-err { color: #ef4444; font-size: 13px; font-weight: 600; text-align: center; }
.phero-retry { align-self: center; min-height: 40px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--gold-dark); background: rgba(212,175,55,0.15); color: var(--gold-primary); font-weight: 700; cursor: pointer; font-family: inherit; }
.hc-row { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--border-mid); border-radius: 10px; background: var(--input-bg); }
.hc-top { display: flex; gap: 10px; }
.hc-icon { width: 48px; height: 48px; flex: none; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--card-sub-bg); color: var(--gold-primary); font-size: 22px; }
.hc-icon img { width: 100%; height: 100%; object-fit: cover; }
.hc-main { flex: 1; min-width: 0; }
.hc-line { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.hc-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main); }
.hc-lv { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.hc-stars { display: flex; align-items: center; gap: 2px; margin-top: 2px; line-height: 1; }
.hc-star { position: relative; display: inline-block; color: #33425e; font-size: 15px; }
.hc-star > span { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: #f59e0b; }
.hc-starlbl { margin-left: 6px; font-size: 11px; color: var(--text-muted); }
.hc-gears { display: flex; flex-wrap: wrap; gap: 6px; }
.hc-g { display: flex; flex-direction: column; align-items: center; width: 46px; }
.hc-gt { width: 46px; height: 46px; border-radius: 8px; border: 1px solid #b45309; background: linear-gradient(135deg, #fcd34d 0%, #d97706 100%); display: flex; align-items: center; justify-content: center; }
.hc-gt img { width: 80%; height: 80%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5)); }
.hc-gt.red { border-color: #991b1b; background: linear-gradient(135deg, #f87171 0%, #b91c1c 100%); }
.hc-genh { margin-top: 3px; font-size: 12px; font-weight: 800; line-height: 1.15; color: var(--text-main); white-space: nowrap; }
.hc-genh.red { color: #ef4444; }
.hc-genh.excl { color: var(--gold-primary); }
.hc-glv { font-size: 11px; font-weight: 600; line-height: 1.15; color: var(--text-muted); white-space: nowrap; }

/* ===== 新版英雄卡 (hx) + 星級方案 1 + 裝備圖示 ===== */
.hx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.hx-card { background: var(--panel-bg); border: 1px solid var(--border-subtle); border-top: 4px solid var(--gold-primary); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; box-shadow: 0 2px 10px rgba(0,0,0,0.12); }
.hx-head { display: flex; gap: 10px; align-items: center; min-width: 0; }
.hx-avatar { width: 56px; height: 56px; flex: none; border-radius: 12px; overflow: hidden; background: var(--input-bg); border: 1px solid var(--border-mid); display: flex; align-items: center; justify-content: center; color: var(--gold-primary); font-size: 24px; }
.hx-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hx-title { min-width: 0; }
.hx-name { font-weight: 800; font-size: 17px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main); }
.hx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hx-chips span { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: var(--card-sub-bg); color: var(--text-main); border: 1px solid var(--border-subtle); }
.hx-gears { display: flex; flex-wrap: wrap; gap: 5px; justify-content: space-between; border-top: 1px solid var(--border-subtle); padding-top: 8px; }
.hx-gears .hc-g, .hx-gears .hc-gt { width: 36px; }
.hx-gears .hc-gt { height: 36px; }
.hx-gears .hc-genh { font-size: 11px; }
.hx-gears .hc-glv { font-size: 10px; }
.hs-wrap { margin-top: 3px; }
.hs-stars { display: flex; gap: 1px; line-height: 1; }
.hs-star { font-size: 17px; color: rgba(148,163,184,0.35); }
.hs-star.on { color: #f59e0b; }
.hs-tier { display: flex; align-items: center; gap: 3px; margin-top: 4px; }
.hs-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(148,163,184,0.35); }
.hs-dot.on { background: #d97706; }
.hs-t { margin-left: 3px; font-size: 11px; font-weight: 700; color: var(--text-muted); }
.hs-max { font-size: 11px; font-weight: 800; color: #d97706; letter-spacing: 1px; }
.hc-gt { position: relative; }
.hc-troop { position: absolute; top: -4px; left: -4px; z-index: 2; width: 14px; height: 14px; border-radius: 4px; background: #475569; border: 1px solid #94a3b8; color: #f8fafc; font-size: 8px; display: flex; align-items: center; justify-content: center; }

/* 展開區寬度跟著表格容器 (不再被撐到比畫面更寬)；橫向捲動時固定在左側 */
.tabulator { container-type: inline-size; }
.player-detail-drawer { position: sticky; left: 0; width: 100cqw; box-sizing: border-box; }
/* 展開列/滑過的底色降低，避免文字被金色吃掉；展開列改用左側金色邊條 */
.tabulator-row:hover { background-color: rgba(212, 175, 55, 0.10) !important; }
.tabulator-row.row-expanded { box-shadow: inset 5px 0 0 var(--gold-primary); }

.hs-stars .hc-star { font-size: 17px; color: rgba(148,163,184,0.35); }

/* 非 302 玩家提示 */
.not-home-banner {
    align-items: flex-start; gap: 10px; padding: 12px 16px; margin-bottom: 16px;
    border-radius: 10px; font-size: 14px; font-weight: 700; line-height: 1.5;
    color: #f59e0b; background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.5);
}
.not-home-banner i { margin-top: 3px; }

/* ---- Tyrant 活動 (後台表單 / 前台活動資訊) ---- */
.ty-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.ty-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.ty-form input { width: 100%; box-sizing: border-box; padding: 8px 10px; font-size: 15px; background: var(--input-bg); color: var(--text-main); border: 1px solid var(--border-mid); border-radius: 5px; font-family: inherit; }
.ty-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ty-table th { text-align: left; font-size: 12px; color: var(--text-muted); padding: 6px 8px; border-bottom: 1px solid var(--border-mid); white-space: nowrap; }
.ty-table td { padding: 8px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.ty-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--border-mid); }
.ty-badge.active { color: #16a34a; border-color: #16a34a; }
.ty-badge.upcoming { color: #d97706; border-color: #d97706; }
.ty-badge.ended { color: var(--text-muted); }
.ty-btn { font-size: 12px; padding: 4px 10px; margin-right: 6px; border: 1px solid var(--border-mid); border-radius: 4px; background: transparent; color: var(--text-main); cursor: pointer; font-family: inherit; }
.ty-btn:hover { border-color: var(--gold-primary); color: var(--gold-primary); }
.ty-btn.danger:hover { border-color: #ef4444; color: #ef4444; }
.fd-event-title { font-size: 20px; font-weight: 800; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fd-event-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 8px; font-size: 14px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.fd-event-meta strong { color: var(--text-main); }
.fd-history-chip { font-size: 13px; padding: 6px 12px; margin: 0 8px 8px 0; border: 1px solid var(--border-mid); border-radius: 999px; background: transparent; color: var(--text-main); cursor: pointer; font-family: inherit; }
.fd-history-chip:hover, .fd-history-chip.on { border-color: var(--gold-primary); color: var(--gold-primary); }

/* ---- 後台：分頁 / 總覽 ---- */
.adm-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.adm-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border-mid); overflow-x: auto; margin-bottom: 22px; scrollbar-width: none; }
.adm-tabs::-webkit-scrollbar { display: none; }
.adm-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 0; margin-bottom: -1px; color: var(--text-muted); font: inherit; font-size: 15px; cursor: pointer; white-space: nowrap; }
.adm-tabs button:hover { color: var(--text-main); }
.adm-tabs button.on { color: var(--text-main); font-weight: 700; border-bottom-color: var(--gold-primary); }
.adm-badge { display: inline-block; min-width: 16px; padding: 0 5px; box-sizing: border-box; border-radius: 8px; background: #ef4444; color: #fff; font-size: 11px; line-height: 16px; text-align: center; vertical-align: 1px; }
.adm-pane { display: none; }
.adm-pane.on { display: block; }
.adm-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--border-mid); border-bottom: 1px solid var(--border-mid); margin-bottom: 28px; }
.adm-stat { padding: 20px 22px; border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.adm-stat:first-child { padding-left: 0; }
.adm-stat:last-child { border-right: 0; }
.adm-stat-l { font-size: 12px; letter-spacing: .04em; color: var(--text-muted); font-weight: 700; }
.adm-stat-v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.adm-stat-v small { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.adm-stat-s { font-size: 13px; color: var(--text-muted); }
.adm-bar { height: 6px; border-radius: 3px; background: var(--border-subtle); overflow: hidden; }
.adm-bar i { display: block; height: 100%; width: 0; background: var(--gold-primary); }
.adm-link { font-size: 12px; color: var(--gold-primary); text-decoration: none; }
.adm-two { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 48px; }
.adm-h { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.adm-alert { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); font-size: 14px; }
.adm-alert a { color: var(--gold-primary); text-decoration: none; font-size: 13px; }
.adm-quick button { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; background: none; border: 0; border-bottom: 1px solid var(--border-subtle); color: var(--text-main); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.adm-quick button:hover { color: var(--gold-primary); }
.adm-quick button small { color: var(--text-muted); font-size: 12px; margin-left: 4px; }
.adm-quick button i { font-style: normal; color: var(--gold-primary); margin-left: auto; }
@media (max-width: 820px) {
    .adm-stats { grid-template-columns: 1fr 1fr; }
    .adm-stat, .adm-stat:first-child { padding: 16px 12px 16px 0; border-right: 0; border-bottom: 1px solid var(--border-subtle); }
    .adm-two { grid-template-columns: 1fr; gap: 24px; }
    .adm-tabs { gap: 20px; }
}
@media (max-width: 480px) { .adm-stats { grid-template-columns: 1fr; } }