/* Delta Force Inventory Simulator - 1:1 High Fidelity Replication */

:root {
    /* 核心颜色体系 */
    --bg-dark-app: #0e1216;
    /* 最底层背景 - 更深 */
    --bg-nav: #121519;
    /* 导航栏背景 - 更深 */
    --bg-panel: #161a1f;
    /* 普通面板背景 */
    --bg-grid-area: #15181c;
    /* 网格区底层背景 */

    /* 核心槽位背景，参考了图片中真正的色值 */
    --bg-slot: #1c1f24;
    --bg-slot-hover: #262b32;
    --bg-slot-selected: #2d353d;

    --border-dim: rgba(255, 255, 255, 0.08);
    --border-slot: rgba(255, 255, 255, 0.05);

    --text-primary: #d1d9e1;
    --text-muted: #79838d;

    --accent-green: #37b26c;
    /* 开始游戏/确定按钮绿色，带点青色 */
    --accent-green-hover: #45c47b;
    /* 开始游戏/确定按钮绿色 */
    --accent-green-hover: #6ae594;

    /* 品质边框色 */
    --qty-white: #d9dbde;
    --qty-green: #63e271;
    --qty-blue: #3b8df1;
    --qty-purple: #c361ff;
    --qty-gold: #ffcc00;
    --qty-red: #e53935;

    /* 品质底色带透明度 */
    --qty-bg-white: rgba(217, 219, 222, 0.12);
    --qty-bg-green: rgba(99, 226, 113, 0.18);
    --qty-bg-blue: rgba(59, 141, 241, 0.18);
    --qty-bg-purple: rgba(195, 97, 255, 0.18);
    --qty-bg-gold: rgba(255, 204, 0, 0.18);
    --qty-bg-red: rgba(229, 57, 53, 0.18);

    --grid-size: 61px;
    /* 游戏内网格一格的大致实际视觉尺寸（原68px的90%） */
    --grid-gap: 2px;
    /* 物块之间的缝隙 */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    font-family: -apple-system, "Microsoft YaHei", sans-serif;
    background-color: var(--bg-dark-app);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 货币全局图标 */
.haf-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: #6a717b;
    color: #121418;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    font-size: 10px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    vertical-align: middle;
    margin-right: 2px;
}

.gold-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: #ffcc00;
    color: #121418;
    width: 14px;
    height: 14px;
    font-size: 10px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    vertical-align: middle;
    margin-right: 2px;
}

/* 顶级全局导航 */
.global-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 36px;
    background-color: var(--bg-nav);
    border-bottom: 1px solid var(--border-dim);
    font-size: 13px;
    padding: 0;
}

.nav-left {
    display: flex;
    height: 100%;
    align-items: center;
}

.nav-brand {
    width: 44px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-right: 1px solid var(--border-dim);
    color: var(--text-muted);
}

.nav-item {
    height: 100%;
    padding: 0 16px;
    display: flex;
    align-items: center;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    border-right: 1px solid rgba(255, 255, 255, 0.03);
}


.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--accent-green);
    font-weight: bold;
    background: linear-gradient(to top, rgba(89, 204, 127, 0.1) 0%, transparent 100%);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-green);
}

.nav-brand-right {
    padding: 0 16px;
    color: var(--text-muted);
}

.nav-right {
    display: flex;
    height: 100%;
    align-items: center;
    position: relative;
}

.nav-right>div {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 100%;
    border-left: 1px solid var(--border-dim);
}

.currency {
    font-family: monospace;
    font-size: 14px;
}

.text-gold {
    color: var(--qty-gold);
}

.nav-icon-btn {
    color: var(--text-muted);
    cursor: pointer;
}

.nav-icon-btn:hover {
    color: #fff;
}

/* 主应用层 */
.app-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* ========== 左侧人物面板 ========== */
.left-character-panel {
    flex: 1;
    display: flex;
    position: relative;
    background: linear-gradient(135deg, rgba(23, 43, 59, 0.3) 0%, rgba(13, 15, 19, 0.95) 80%);
}

.character-preview-area {
    position: absolute;
    left: -100px;
    bottom: 0;
    width: 600px;
    height: 800px;
    background: radial-gradient(circle at center, rgba(89, 204, 127, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.character-bottom-info {
    position: absolute;
    bottom: 40px;
    left: 40px;
    z-index: 10;
}

.char-name {
    font-size: 26px;
    font-weight: normal;
    margin-bottom: 4px;
    letter-spacing: 2px;
}

.char-setting {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.char-weight {
    display: flex;
    align-items: center;
    font-size: 14px;
}

.weight-current {
    color: #fff;
    font-weight: bold;
    margin-left: 6px;
    font-size: 14px;
}

.weight-max {
    color: var(--text-muted);
    margin-left: 4px;
    font-size: 12px;
}

.equip-section {
    width: 350px;
    margin-left: auto;
    border-left: 1px solid var(--border-dim);
    background-color: rgba(18, 20, 24, 0.7);
    display: flex;
    flex-direction: column;
}

.equip-header {
    height: 30px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-dim);
}

.equip-header .haf-icon {
    margin-left: 8px;
}

.equip-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.equip-group {
    margin-bottom: 16px;
}

.group-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
}

.help-icon {
    display: inline-block;
    border: 1px solid var(--text-muted);
    border-radius: 50%;
    width: 12px;
    height: 12px;
    text-align: center;
    line-height: 10px;
    font-size: 10px;
    margin-left: 4px;
}

.slots-row {
    display: flex;
    gap: var(--grid-gap);
}

.equip-slot {
    width: 60px;
    height: 60px;
    background-color: var(--bg-slot);
    border: 1px solid var(--border-slot);
}

.equip-slot.secure {
    border-top: 2px solid var(--accent-green);
    background-color: rgba(55, 178, 108, 0.05);
}

.bag-slot-container {
    display: flex;
}

.large-bag-placeholder {
    width: 122px;
    height: 184px;
}

.keycard-container {
    display: flex;
    gap: 8px;
}

.keycard-box {
    width: 48px;
}

.keycard-slot {
    height: 122px;
    position: relative;
}

.lock-overlay {
    position: absolute;
    bottom: 4px;
    left: 4px;
    font-size: 12px;
}

.keycard-details {
    flex: 1;
    border: 1px solid var(--border-dim);
    padding: 6px;
    font-size: 11px;
    color: #fff;
}

.card-row {
    margin-bottom: 4px;
    color: var(--text-muted);
}

.keycard-actions {
    display: flex;
    margin-top: 4px;
    gap: 4px;
}

.keycard-btn-left {
    flex: 1;
    border: 1px solid var(--border-dim);
    font-size: 11px;
    text-align: center;
    padding: 4px;
    cursor: pointer;
}

.keycard-btn-right {
    width: 48px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 11px;
    text-align: center;
    padding: 4px;
    cursor: pointer;
}


/* ========== 右侧核心仓库 ========== */
.right-warehouse-panel {
    flex: none;
    /* 精确宽度：侧边栏44px + 滚动区左右padding各12px + 9列网格 + 8条间隙 */
    width: calc(44px + 24px + 9 * var(--grid-size) + 8 * var(--grid-gap));
    display: flex;
    flex-direction: column;
    background-color: var(--bg-nav);
}

.warehouse-header {
    height: 34px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-dim);
    padding: 0 16px;
}

.warehouse-header h2 {
    font-size: 14px;
    font-weight: normal;
    color: var(--text-primary);
    margin: 0;
}

.warehouse-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 细长侧边栏 */
.warehouse-sidebar {
    width: 44px;
    background-color: #1a1c21;
    border-right: 1px solid var(--border-dim);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-top,
.sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
}

.sidebar-icon {
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: 8px;
    border-radius: 2px;
}

.sidebar-icon:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-icon svg {
    width: 18px;
    height: 18px;
}

.sidebar-divider {
    margin: 8px 0;
    width: 24px;
    height: 1px;
    background-color: var(--border-dim);
}

.box-icon.nav-active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-left: 2px solid #fff;
}

.box-icon .text-icon {
    font-family: "Times New Roman", Times, serif;
    font-size: 14px;
    font-weight: bold;
}

.box-icon.plus {
    border: 1px dashed var(--text-muted);
    margin-top: 4px;
}

.active-highlight {
    background-color: rgba(89, 204, 127, 0.1);
    color: var(--text-primary);
}

.active-highlight:hover {
    background-color: var(--accent-green);
    color: #fff;
}

/* 仓库主区域 */
.warehouse-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-grid-area);
    position: relative;
    /* hide overflow of footer pushing down */
    overflow: hidden;
}

/* 物品清单独立滚动区 */
.inventory-scroll-area {
    flex: 1;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 12px;
    overscroll-behavior: none;
    /* 完全隐藏原生滚动条 */
    scrollbar-width: none;
}

.inventory-scroll-area::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* JS自定义滑块轨道 */
.custom-scrollbar-track {
    position: absolute;
    right: 2px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
    z-index: 50;
}

.custom-scrollbar-thumb {
    position: absolute;
    right: 0;
    width: 3px;
    min-height: 24px;
    background: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    transition: background 0.15s;
}

/* 批量出售时的模式头部 */
.batch-sell-header {
    height: 40px;
    background-color: #21252b;
    border-bottom: 1px solid var(--border-dim);
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

.batch-sell-header:hover {
    background-color: #2a2e35;
}

.back-arrow {
    font-size: 18px;
    margin-right: 8px;
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

/* 网格容器包装 */
.warehouse-grid-wrapper {
    position: relative;
    width: 100%;
}

.bg-grid {
    display: grid;
    grid-template-columns: repeat(9, var(--grid-size));
    grid-auto-rows: var(--grid-size);
    gap: var(--grid-gap);
    pointer-events: none;
    z-index: 1;
}

.bg-grid-slot {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-sizing: border-box;
}

.inventory-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(9, var(--grid-size));
    grid-auto-rows: var(--grid-size);
    gap: var(--grid-gap);
}

#drag-highlight {
    position: relative;
    z-index: 10;
    pointer-events: none;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.15);
    /* 半透明白底 */
    border: 1px solid rgba(255, 255, 255, 0.4);
    /* 内敛的白边 */
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1);
}

#drag-highlight.highlight-valid {
    /* 依然可以保留微微发绿的光晕代表可以放 */
    box-shadow: inset 0 0 10px rgba(106, 229, 148, 0.2);
    border-color: rgba(106, 229, 148, 0.6);
}

#drag-highlight.highlight-invalid {
    /* 放不下时微微发红 */
    box-shadow: inset 0 0 10px rgba(229, 57, 53, 0.2);
    border-color: rgba(229, 57, 53, 0.6);
    background-color: rgba(255, 255, 255, 0.1);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* 独立物品槽位设计 */
.item-slot {
    background-color: var(--item-bg-color, var(--qty-bg-white));
    position: relative;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: none;
    transition: filter 0.1s ease;
}

.item-slot:hover {
    filter: brightness(1.2);
}

/* 拖拽交互样式 */
.item-slot.dragging {
    opacity: 0.5;
    z-index: 100;
}

.item-slot.drag-over {
    border-color: #ff9800;
    /* 暂且给一个橙色代表放置目标 */
    filter: brightness(1.5);
    transform: scale(1.02);
}


/* 物品全名（左上角对齐） */
.item-name-overlay {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 11px;
    color: #fff;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000, 0px 0px 1px #000;
    pointer-events: none;
    z-index: 10;
    text-align: left;
    max-width: 95%;
    line-height: 1.1;
}

.item-img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    pointer-events: none;
}

.item-slot.rotated .item-img {
    transform: translate(-50%, -50%) rotate(90deg);
    max-width: none;
    max-height: none;
    width: 90%;
    height: 90%;
    object-fit: contain;
}


.item-qty {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 11px;
    color: #e2e2e2;
    font-family: Arial, sans-serif;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000, 0px 0px 1px #000;
    pointer-events: none;
    z-index: 10;
}

.item-slot.selected {
    box-shadow: inset 0 0 0 1px #fff;
    background-color: var(--bg-slot-selected);
}

.item-checkmark {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
}

.item-slot.selected .item-checkmark {
    opacity: 1;
}

.item-checkmark svg {
    width: 10px;
    height: 10px;
    fill: #fff;
}

.span-1x1 {
    grid-column: span 1;
    grid-row: span 1;
}

.span-1x2 {
    grid-column: span 1;
    grid-row: span 2;
}

.span-2x1 {
    grid-column: span 2;
    grid-row: span 1;
}

.span-2x2 {
    grid-column: span 2;
    grid-row: span 2;
}

.span-4x2 {
    grid-column: span 4;
    grid-row: span 2;
}

.span-2x3 {
    grid-column: span 2;
    grid-row: span 3;
}

/* 批量出售底部栏 */
.batch-sell-footer {
    height: 48px;
    background-color: #1e2227;
    border-top: 1px solid var(--border-dim);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 16px;
}

.sell-stats {
    font-size: 13px;
    margin-right: 16px;
    color: var(--text-muted);
}

#selected-value {
    color: #fff;
    font-size: 14px;
    font-family: monospace;
    margin-left: 2px;
}

.btn-execute {
    background-color: transparent;
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
    padding: 6px 30px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 2px;
}

.btn-execute:hover {
    background-color: rgba(89, 204, 127, 0.1);
}

.btn-execute:disabled {
    border-color: #3e444a;
    color: #5a636c;
    cursor: not-allowed;
    background: transparent;
}

/* ========== 模态框: 确认出售 (1:1 图片4样式) ========== */
/* 排位模式匹配浮窗 - 左侧固定 */
#modal-ranked.matching-float {
    background: transparent;
    justify-content: flex-start;
    align-items: flex-start;
    pointer-events: none;
}

#modal-ranked.matching-float .modal-content {
    pointer-events: auto;
    margin: 80px 20px 20px 20px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

/* 匹配界面长方形布局 */
#modal-ranked.matching-float #ranked-matching-area {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

#modal-ranked.matching-float .mm-radar-wrap {
    flex-shrink: 0;
    order: 2;
}

#modal-ranked.matching-float .mm-status-text,
#modal-ranked.matching-float #ranked-wait-info,
#modal-ranked.matching-float #ranked-cancel-match-btn {
    order: 1;
}

#modal-ranked.matching-float .mm-status-text {
    margin: 0 0 8px 0;
}

#modal-ranked.matching-float #ranked-wait-info {
    margin: 0 0 12px 0;
}

/* 匹配界面主题 */
#modal-ranked.matching-float .modal-content {
    position: relative;
    overflow: hidden;
}

#modal-ranked.matching-float .modal-content::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}

/* 主题1: 金色 - 菱形花纹 */
#modal-ranked.matching-float.theme-gold .modal-content {
    background: linear-gradient(135deg, #1a1510 0%, #2a2010 100%);
    border: 2px solid rgba(200,168,75,0.4);
}

#modal-ranked.matching-float.theme-gold .modal-content::before {
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 20px, rgba(200,168,75,0.3) 20px, rgba(200,168,75,0.3) 21px),
        repeating-linear-gradient(-45deg, transparent, transparent 20px, rgba(200,168,75,0.3) 20px, rgba(200,168,75,0.3) 21px);
}

/* 主题2: 蓝色 - 六边形花纹 */
#modal-ranked.matching-float.theme-blue .modal-content {
    background: linear-gradient(135deg, #0a1520 0%, #0f1f35 100%);
    border: 2px solid rgba(100,150,255,0.4);
}

#modal-ranked.matching-float.theme-blue .modal-content::before {
    background-image: radial-gradient(circle at 20px 20px, rgba(100,150,255,0.3) 2px, transparent 2px);
    background-size: 40px 40px;
}

/* 主题3: 紫色 - 波浪花纹 */
#modal-ranked.matching-float.theme-purple .modal-content {
    background: linear-gradient(135deg, #1a0a20 0%, #2a1535 100%);
    border: 2px solid rgba(180,100,255,0.4);
}

#modal-ranked.matching-float.theme-purple .modal-content::before {
    background-image:
        repeating-linear-gradient(90deg, transparent, transparent 30px, rgba(180,100,255,0.3) 30px, rgba(180,100,255,0.3) 32px),
        repeating-linear-gradient(0deg, transparent, transparent 15px, rgba(180,100,255,0.2) 15px, rgba(180,100,255,0.2) 16px);
}

/* 主题4: 红色 - 斜线花纹 */
#modal-ranked.matching-float.theme-red .modal-content {
    background: linear-gradient(135deg, #200a0a 0%, #351515 100%);
    border: 2px solid rgba(255,100,100,0.4);
}

#modal-ranked.matching-float.theme-red .modal-content::before {
    background-image: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 25px,
        rgba(255,100,100,0.3) 25px,
        rgba(255,100,100,0.3) 27px
    );
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.sell-confirm-box {
    width: 600px;
    background: #191c20;
    border: 1px solid var(--border-dim);
    display: flex;
    flex-direction: column;
}

.sell-confirm-body {
    max-height: 50vh;
    overflow-y: auto;
    padding: 16px;
}

.sell-row {
    display: flex;
    align-items: center;
    background: #20242a;
    border: 1px solid var(--border-dim);
    margin-bottom: 8px;
}

.sell-row-img {
    width: 60px;
    height: 60px;
    position: relative;
    border-bottom: 3px solid var(--item-color);
    background: #181b20;
}

.sell-row-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sell-row-img .fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    text-align: center;
    color: #aaa;
}

.sell-row-info {
    flex: 1;
    padding-left: 16px;
    font-size: 13px;
    color: var(--text-primary);
}

.sell-row-price {
    padding-right: 16px;
    font-size: 14px;
    font-family: monospace;
    display: flex;
    align-items: center;
}

.sell-confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px;
    background: #13161a;
    border-top: 1px solid var(--border-dim);
}

.btn-cancel {
    background: transparent;
    border: 1px solid #454d55;
    color: #a9b3bd;
    padding: 8px 30px;
    cursor: pointer;
    border-radius: 2px;
}

.btn-cancel:hover {
    border-color: #fff;
    color: #fff;
}

.btn-confirm-execute {
    background: transparent;
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 8px 30px;
    cursor: pointer;
    border-radius: 2px;
}

.btn-confirm-execute:hover {
    background: rgba(89, 204, 127, 0.1);
}

/* ========== 模态框: 配置物品 ========== */
.config-modal {
    width: 600px;
    background: #191c20;
    padding: 24px;
    border: 1px solid var(--border-dim);
    border-radius: 4px;
}

.config-modal h2 {
    font-size: 16px;
    margin-bottom: 20px;
    font-weight: normal;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 8px;
    margin-top: 0;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-group input,
.form-group select {
    width: 100%;
    background: #111;
    color: #fff;
    border: 1px solid #333;
    padding: 6px 10px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent-green);
    outline: none;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.form-row-2 {
    display: flex;
    gap: 12px;
}

.form-row-2>div {
    flex: 1;
}

.btn-primary {
    background: var(--accent-green);
    color: #000;
    border: none;
    padding: 6px 16px;
    cursor: pointer;
}

.btn-secondary {
    background: transparent;
    color: #fff;
    border: 1px solid #555;
    padding: 6px 16px;
    cursor: pointer;
}

.btn-danger {
    background: var(--qty-red);
    color: #fff;
    border: none;
    padding: 6px 16px;
    cursor: pointer;
}

/* 隐蔽危险区域（折叠放置在配置框底部） */
.danger-zone {
    margin-top: 20px;
    border-top: 1px solid rgba(229, 57, 53, 0.2);
    padding-top: 10px;
}

.danger-zone summary {
    font-size: 11px;
    color: rgba(229, 57, 53, 0.5);
    cursor: pointer;
    user-select: none;
    list-style: none;
    padding: 2px 0;
}

.danger-zone summary:hover {
    color: rgba(229, 57, 53, 0.85);
}

.danger-zone[open] summary {
    color: rgba(229, 57, 53, 0.75);
    margin-bottom: 8px;
}

.danger-zone #btn-reset-inventory {
    background: transparent;
    color: rgba(229, 57, 53, 0.7);
    border: 1px solid rgba(229, 57, 53, 0.35);
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    width: 100%;
}

.danger-zone #btn-reset-inventory:hover {
    background: rgba(229, 57, 53, 0.1);
    color: var(--qty-red);
    border-color: var(--qty-red);
}

/* 调试按钮 */
.debug-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 99;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: 1px dashed var(--accent-green);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    opacity: 1;
    transition: all 0.2s;
}

.debug-btn:hover {
    opacity: 1;
    background: #000;
}

/* RTS框选效果 */
#selection-box {
    position: fixed;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.6);
    pointer-events: none;
    z-index: 999;
}

#selection-overlay {
    position: fixed;
    inset: 0;
    z-index: 998;
    cursor: crosshair;
}

/* ========== 模态框: 部门存档 ========== */
.department-modal {
    width: 500px;
}

.save-slots {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.save-slot {
    background: #20242a;
    border: 1px solid var(--border-dim);
    padding: 16px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.save-slot:hover {
    background: #2a2e35;
    border-color: var(--accent-green);
}

.save-slot.empty {
    color: var(--text-muted);
    justify-content: center;
    border-style: dashed;
}

.slot-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.slot-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: bold;
}

.slot-status {
    font-size: 12px;
    color: var(--accent-green);
}

.local-actions {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-dim);
}

.local-actions button {
    flex: 1;
}

/* ========== 交易行面板样式 ========== */
.trading-post-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0d1117;
    border-right: 1px solid #1e2530;
    z-index: 20;
    overflow: hidden;
}

.tp-header {
    padding: 12px 14px 0;
    flex-shrink: 0;
}

.tp-header h3 {
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #c8a84b;
    font-weight: 600;
    margin-bottom: 10px;
}

.tp-search {
    position: relative;
    margin-bottom: 0;
}

#tp-search-input {
    width: 100%;
    background: #111620;
    border: 1px solid #1e2530;
    border-bottom: none;
    color: #ccc;
    padding: 8px 32px 8px 12px;
    font-size: 12px;
    border-radius: 3px 3px 0 0;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

#tp-search-input:focus {
    outline: none;
    border-color: #c8a84b;
}

.tp-search-clear {
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #444;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
    display: none;
}
.tp-search-clear.visible { display: block; color: #666; }
.tp-search-clear:hover { color: #aaa; }

/* 选中物品操作栏 */
.tp-action-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #111620;
    border: 1px solid #1e2530;
    border-top: 1px solid #2a2f3a;
    flex-shrink: 0;
}

.tp-action-bar.no-selection {
    opacity: 0.4;
    pointer-events: none;
}

.tp-selected-preview {
    width: 28px; height: 28px;
    border-radius: 3px;
    border: 1px solid #2a2f3a;
    background: #0a0e14;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.tp-selected-preview img {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
}

.tp-selected-name {
    flex: 1;
    font-size: 11px;
    color: #aaa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tp-qty-input {
    width: 44px;
    background: #0a0e14;
    border: 1px solid #2a2f3a;
    color: #ccc;
    padding: 4px 6px;
    font-size: 12px;
    border-radius: 3px;
    text-align: center;
}
.tp-qty-input:focus { outline: none; border-color: #c8a84b; }

.tp-add-btn {
    background: #c8a84b;
    color: #000;
    border: none;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 3px;
    cursor: pointer;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}
.tp-add-btn:hover { background: #ffe066; }

.tp-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-bottom: 20px;
}

.tp-list::-webkit-scrollbar { width: 4px; }
.tp-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
}

/* 文件夹分组 */
.tp-folder-group { margin-bottom: 2px; }

.tp-folder-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 11px;
    color: #3d4a5a;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, color 0.15s;
    position: sticky;
    top: 0;
    background: #0d1117;
    z-index: 2;
    border-bottom: 1px solid #111620;
}

.tp-folder-header:hover { background: #111620; color: #8a9ab0; }

.tp-folder-header .folder-arrow {
    font-size: 8px;
    color: #2a2f3a;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.tp-folder-header.collapsed .folder-arrow { transform: rotate(-90deg); }
.tp-folder-header .folder-icon { font-size: 12px; flex-shrink: 0; }
.tp-folder-header .folder-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 10px;
}
.tp-folder-header .folder-count {
    font-size: 10px;
    color: #2a2f3a;
    flex-shrink: 0;
}

/* 物品网格 */
.tp-folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 6px;
    padding: 8px 10px;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.2s ease;
    max-height: 9999px;
    opacity: 1;
}
.tp-folder-grid.collapsed {
    max-height: 0; opacity: 0;
    padding-top: 0; padding-bottom: 0;
    pointer-events: none;
}

/* 物品卡片 */
.tp-item {
    background: #111620;
    border: 1px solid #1e2530;
    border-radius: 3px;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px;
    cursor: grab;
    position: relative;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    box-sizing: border-box;
}

.tp-item:hover {
    border-color: #c8a84b;
    background: #161c28;
    transform: translateY(-1px);
    z-index: 1;
}

.tp-item.tp-selected {
    border-color: #c8a84b;
    background: rgba(200,168,75,0.1);
    box-shadow: 0 0 0 1px #c8a84b;
}

.tp-item:active { cursor: grabbing; }

.tp-item img {
    max-width: 100%; max-height: 68%;
    object-fit: contain;
    pointer-events: none;
    /* 未加载时占位，防止高度塌缩（确保 IntersectionObserver 能检测到） */
    min-height: 32px;
    background: rgba(255,255,255,0.04) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Crect width='20' height='20' rx='3' fill='%23ffffff10'/%3E%3C/svg%3E") center/20px no-repeat;
}
.tp-item img[src] {
    background: none;
    min-height: unset;
}

.tp-item .tp-item-name {
    margin-top: 4px;
    font-size: 9px;
    color: #4a5a6a;
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    letter-spacing: 0.3px;
}

.tp-item:hover .tp-item-name { color: #8a9ab0; }
.tp-item.tp-selected .tp-item-name { color: #c8a84b; }

/* 物品尺寸角标 */
.tp-item-size-tag {
    position: absolute;
    bottom: 2px; right: 3px;
    font-size: 8px;
    color: #2a3a4a;
    pointer-events: none;
    letter-spacing: 0;
}
.tp-item:hover .tp-item-size-tag { color: #4a5a6a; }

/* Tooltip */
.tp-tooltip {
    position: fixed;
    z-index: 20000;
    background: #0a0e14;
    border: 1px solid #2a2f3a;
    border-radius: 4px;
    padding: 8px 12px;
    pointer-events: none;
    min-width: 140px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.7);
}
.tp-tooltip-name {
    font-size: 12px;
    color: #e8e8e8;
    font-weight: 600;
    margin-bottom: 4px;
}
.tp-tooltip-row {
    font-size: 10px;
    color: #555;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.tp-tooltip-row span:last-child { color: #8a9ab0; }

/* 交易行物品右键配置菜单 */
.tp-config-menu {
    position: fixed;
    z-index: 10000;
    background: #0d1117;
    border: 1px solid #2a2f3a;
    border-radius: 4px;
    padding: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    min-width: 200px;
    color: #eee;
}

.tp-config-row { margin-bottom: 10px; }

.tp-config-row label {
    display: block;
    font-size: 10px;
    color: #3d4a5a;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.tp-config-row input, .tp-config-row select {
    width: 100%;
    background: #111620;
    border: 1px solid #1e2530;
    color: #ccc;
    padding: 5px 8px;
    font-size: 12px;
    border-radius: 3px;
    box-sizing: border-box;
}
.tp-config-row input:focus,
.tp-config-row select:focus { outline: none; border-color: #c8a84b; }

.tp-config-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.tp-config-btn {
    padding: 5px 14px;
    font-size: 11px;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid transparent;
    letter-spacing: 0.5px;
}
.tp-config-btn.save { background: #c8a84b; color: #000; font-weight: 700; }
.tp-config-btn.save:hover { background: #ffe066; }
.tp-config-btn.cancel { background: none; color: #555; border-color: #2a2f3a; }
.tp-config-btn.cancel:hover { color: #aaa; }
    flex-shrink: 0;
}

.tp-folder-header.collapsed .folder-arrow {
    transform: rotate(-90deg);
}

.tp-folder-header .folder-icon {
    font-size: 13px;
    flex-shrink: 0;
}

.tp-folder-header .folder-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.tp-folder-header .folder-count {
    font-size: 10px;
    color: #444;
    flex-shrink: 0;
}


/* 适配左侧面板的显示切换 */
.hidden {
    display: none !important;
}

/* 存档操作选择模态框 */
.slot-action-modal {
    width: 360px;
}

.slot-action-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin: -10px 0 20px;
    line-height: 1.5;
}

.slot-action-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slot-action-btns button {
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    width: 100%;
    text-align: left;
}

/* 密码错误提示 */
.pwd-error {
    color: var(--qty-red);
    font-size: 12px;
    margin-top: -6px;
    margin-bottom: 8px;
}

/* ========== 账号登录/注册弹窗 ========== */
.auth-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-dim);
    margin-bottom: 18px;
}
.auth-tab {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .2s, border-color .2s;
}
.auth-tab.active {
    color: var(--accent-green);
    border-bottom-color: var(--accent-green);
}
.auth-tab:hover { color: #fff; }
.auth-form.hidden { display: none; }
.captcha-group .captcha-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.captcha-group .captcha-row input {
    flex: 1;
}
.captcha-question {
    background: #111;
    border: 1px solid #333;
    padding: 5px 12px;
    font-size: 14px;
    color: #ffd866;
    white-space: nowrap;
    min-width: 90px;
    text-align: center;
    user-select: none;
}
.captcha-refresh {
    background: transparent;
    border: 1px solid #555;
    color: #aaa;
    font-size: 18px;
    cursor: pointer;
    padding: 3px 8px;
    line-height: 1;
}
.captcha-refresh:hover { color: #fff; border-color: var(--accent-green); }
.auth-user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 0;
}
.auth-display-name {
    font-size: 18px;
    color: var(--accent-green);
    font-weight: bold;
}
.nav-user-badge {
    color: var(--accent-green);
    font-size: 12px;
    margin-left: 6px;
    cursor: pointer;
}

/* 浮动 Toast 通知 */
.dept-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e2227;
    border: 1px solid #3a4049;
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 99999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    white-space: nowrap;
}

.dept-toast.dept-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.dept-toast.dept-toast-success {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.dept-toast.dept-toast-error {
    border-color: var(--qty-red);
    color: var(--qty-red);
}

/* ==================
   联机模式
   ================== */
.match-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top-color: #c8a84b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#nav-online {
    cursor: pointer;
}

/* ==================
   匹配弹窗 - 帅气版
   ================== */
.matchmaking-modal {
    width: 780px;
    background: #0d1117;
    border: 1px solid #2a2f3a;
    border-radius: 4px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 0 60px rgba(200,168,75,0.15), 0 20px 60px rgba(0,0,0,0.8);
}

.mm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #111620;
    border-bottom: 1px solid #1e2530;
}

.mm-mode-label {
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #c8a84b;
    font-weight: 600;
}

.mm-username-label {
    font-size: 11px;
    color: #555;
    letter-spacing: 1px;
}

/* 雷达扫描动画 */
#match-status-area {
    padding: 36px 20px 28px;
    text-align: center;
}

.mm-radar-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 24px;
}

.mm-radar-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(200,168,75,0.25);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.mm-radar-ring.r1 { width: 140px; height: 140px; }
.mm-radar-ring.r2 { width: 96px;  height: 96px;  border-color: rgba(200,168,75,0.35); }
.mm-radar-ring.r3 { width: 52px;  height: 52px;  border-color: rgba(200,168,75,0.5); }

.mm-radar-dot {
    position: absolute;
    width: 8px; height: 8px;
    background: #c8a84b;
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px #c8a84b;
}

.mm-radar-sweep {
    position: absolute;
    width: 70px; height: 70px;
    top: 50%; left: 50%;
    transform-origin: 0 0;
    background: conic-gradient(from 0deg, transparent 70%, rgba(200,168,75,0.4) 100%);
    animation: radar-spin 2s linear infinite;
    border-radius: 0 100% 0 0;
}

@keyframes radar-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.mm-status-text {
    color: #8a9ab0;
    font-size: 13px;
    letter-spacing: 1px;
    margin: 0 0 8px;
}

.mm-queue-info {
    color: #3d4a5a;
    font-size: 11px;
    letter-spacing: 1px;
}

/* VS 对战区 */
#match-result-area {
    padding: 32px 20px 20px;
    text-align: center;
}

.mm-vs-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    animation: mm-slide-in 0.5s cubic-bezier(0.22,1,0.36,1) both;
}

@keyframes mm-slide-in {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

.mm-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 140px;
}

.mm-player-left { animation: mm-enter-left 0.5s 0.1s cubic-bezier(0.22,1,0.36,1) both; }
.mm-player-right { animation: mm-enter-right 0.5s 0.1s cubic-bezier(0.22,1,0.36,1) both; }

@keyframes mm-enter-left {
    from { opacity: 0; transform: translateX(-40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes mm-enter-right {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

.mm-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid;
}

.mm-avatar-self {
    background: rgba(200,168,75,0.1);
    border-color: #c8a84b;
    color: #c8a84b;
}
.mm-avatar-self svg { width: 32px; height: 32px; }

.mm-avatar-opponent {
    background: rgba(220,50,50,0.1);
    border-color: #dc3232;
    color: #dc3232;
}
.mm-avatar-opponent svg { width: 32px; height: 32px; }

.mm-player-name {
    font-size: 15px;
    font-weight: 700;
    color: #e8e8e8;
    letter-spacing: 1px;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mm-player-tag {
    font-size: 10px;
    letter-spacing: 2px;
    color: #c8a84b;
    background: rgba(200,168,75,0.1);
    border: 1px solid rgba(200,168,75,0.3);
    padding: 2px 8px;
    border-radius: 2px;
}

.mm-tag-enemy {
    color: #dc3232;
    background: rgba(220,50,50,0.1);
    border-color: rgba(220,50,50,0.3);
}

.mm-vs-badge {
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    animation: mm-vs-pop 0.4s 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes mm-vs-pop {
    from { opacity: 0; transform: scale(0); }
    to   { opacity: 1; transform: scale(1); }
}

.mm-vs-text {
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(255,255,255,0.4);
}

.mm-found-text {
    margin-top: 24px;
    font-size: 11px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #4caf50;
    animation: mm-found-fade 0.6s 0.6s both;
}

@keyframes mm-found-fade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mm-footer {
    padding: 16px 20px;
    display: flex;
    justify-content: center;
    gap: 12px;
    border-top: 1px solid #1e2530;
    background: #0a0e14;
}

/* ==================
   排行榜模态框
   ================== */
.lb-modal {
    width: 870px;
    max-height: 85vh;
    background: #0d1117;
    border: 1px solid #2a2f3a;
    border-radius: 4px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 60px rgba(200,168,75,0.1), 0 20px 60px rgba(0,0,0,0.8);
}

.lb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #111620;
    border-bottom: 1px solid #1e2530;
    flex-shrink: 0;
}

.lb-title {
    font-size: 13px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #c8a84b;
    font-weight: 600;
}

.lb-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lb-season-label {
    font-size: 11px;
    color: #444;
    letter-spacing: 1px;
}

.lb-help-btn, .lb-close-btn {
    background: none;
    border: 1px solid #2a2f3a;
    color: #666;
    width: 24px; height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    transition: color 0.2s, border-color 0.2s;
}
.lb-help-btn:hover { color: #c8a84b; border-color: #c8a84b; }
.lb-close-btn:hover { color: #fff; border-color: #555; }

/* 规则说明 */
.lb-rules {
    background: #0a0e14;
    border-bottom: 1px solid #1e2530;
    padding: 14px 20px;
    flex-shrink: 0;
}

.lb-rules-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lb-rule-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #aaa;
}

.lb-rule-icon {
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}
.lb-rule-gold   { color: #c8a84b; }
.lb-rule-silver { color: #a0a8b8; }
.lb-rule-bronze { color: #cd7f32; }
.lb-rule-90 {
    font-size: 10px;
    background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lb-rule-divider {
    height: 1px;
    background: #1e2530;
    margin: 4px 0;
}

.lb-rule-note {
    font-size: 11px;
    color: #444;
}

/* Tabs */
.lb-tabs {
    display: flex;
    border-bottom: 1px solid #1e2530;
    flex-shrink: 0;
}

.lb-tab {
    flex: 1;
    background: none;
    border: none;
    color: #555;
    padding: 10px 0;
    font-size: 13px;
    cursor: pointer;
    letter-spacing: 1px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.lb-tab:hover { color: #aaa; }
.lb-tab.active { color: #c8a84b; border-bottom-color: #c8a84b; }

/* 第一周提示 */
.lb-first-week-tip {
    text-align: center;
    font-size: 11px;
    color: #555;
    padding: 8px 20px;
    background: #0a0e14;
    border-bottom: 1px solid #1e2530;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* 列表头 */
.lb-list-header {
    display: grid;
    grid-template-columns: 48px 1fr 80px 80px 70px;
    padding: 8px 20px;
    font-size: 10px;
    letter-spacing: 1px;
    color: #3d4a5a;
    text-transform: uppercase;
    border-bottom: 1px solid #1a1f28;
    flex-shrink: 0;
}

/* 列表 */
.lb-list {
    overflow-y: auto;
    flex: 1;
}

.lb-loading {
    text-align: center;
    color: #333;
    padding: 40px;
    font-size: 13px;
}

.lb-empty {
    text-align: center;
    color: #333;
    padding: 40px;
    font-size: 13px;
}

.lb-row {
    display: grid;
    grid-template-columns: 48px 1fr 80px 80px 70px;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #111620;
    transition: background 0.15s;
}
.lb-row:hover { background: #111620; }

/* 前三名高亮 */
.lb-row.rank-1 { background: rgba(200,168,75,0.06); }
.lb-row.rank-2 { background: rgba(160,168,184,0.04); }
.lb-row.rank-3 { background: rgba(205,127,50,0.04); }

.lb-col-rank {
    font-size: 14px;
    font-weight: 700;
    color: #3d4a5a;
}
.lb-row.rank-1 .lb-col-rank { color: #c8a84b; font-size: 16px; }
.lb-row.rank-2 .lb-col-rank { color: #a0a8b8; }
.lb-row.rank-3 .lb-col-rank { color: #cd7f32; }

.lb-col-player {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lb-avatar-wrap {
    position: relative;
    width: 32px; height: 32px;
    flex-shrink: 0;
}

.lb-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #1a1f28;
    border: 1px solid #2a2f3a;
    display: flex; align-items: center; justify-content: center;
    color: #3d4a5a;
}
.lb-avatar svg { width: 18px; height: 18px; }

.lb-username {
    font-size: 13px;
    color: #ccc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-col-score {
    font-size: 13px;
    color: #c8a84b;
    font-weight: 600;
    text-align: right;
}

.lb-col-record {
    font-size: 12px;
    color: #555;
    text-align: right;
}

.lb-col-winrate {
    font-size: 12px;
    color: #aaa;
    text-align: right;
}

/* ==================
   徽章系统
   ================== */
.mm-avatar-wrap {
    position: relative;
    display: inline-block;
}

.badge-corner {
    position: absolute;
    top: -6px; right: -6px;
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 8px;
    font-weight: 900;
    z-index: 2;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

/* 90徽章显示在左边 */
.badge-corner.badge-left {
    right: auto;
    left: -6px;
}

/* 金色徽章 */
.badge-gold {
    background: radial-gradient(circle at 35% 35%, #ffe066, #c8a84b 55%, #7a5c10);
    box-shadow: 0 0 8px rgba(200,168,75,0.8), 0 2px 6px rgba(0,0,0,0.6);
    color: #3a2800;
    animation: badge-gold-pulse 2s ease-in-out infinite;
}
.badge-gold::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, rgba(255,255,200,0.55), transparent 60%);
    pointer-events: none;
}
.badge-gold::after {
    content: '★';
    font-size: 10px;
    color: #3a2800;
    text-shadow: 0 1px 2px rgba(255,220,80,0.8);
}
@keyframes badge-gold-pulse {
    0%,100% { box-shadow: 0 0 8px rgba(200,168,75,0.8), 0 2px 6px rgba(0,0,0,0.6); }
    50%      { box-shadow: 0 0 16px rgba(255,220,80,1),  0 2px 6px rgba(0,0,0,0.6); }
}

/* 银色徽章 */
.badge-silver {
    background: radial-gradient(circle at 35% 35%, #f0f4f8, #a0a8b8 55%, #4a5060);
    box-shadow: 0 0 6px rgba(160,168,184,0.6), 0 2px 6px rgba(0,0,0,0.6);
    color: #1a1f28;
    animation: badge-silver-shine 3s ease-in-out infinite;
}
.badge-silver::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.6), transparent 55%);
    pointer-events: none;
}
.badge-silver::after {
    content: '✦';
    font-size: 9px;
    color: #1a1f28;
}
@keyframes badge-silver-shine {
    0%,100% { box-shadow: 0 0 6px rgba(160,168,184,0.6), 0 2px 6px rgba(0,0,0,0.6); }
    50%      { box-shadow: 0 0 12px rgba(200,210,230,0.9), 0 2px 6px rgba(0,0,0,0.6); }
}

/* 铜色徽章 */
.badge-bronze {
    background: radial-gradient(circle at 35% 35%, #f0a060, #cd7f32 55%, #6b3a10);
    box-shadow: 0 0 6px rgba(205,127,50,0.6), 0 2px 6px rgba(0,0,0,0.6);
    color: #2a1000;
}
.badge-bronze::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, rgba(255,200,120,0.5), transparent 55%);
    pointer-events: none;
}
.badge-bronze::after {
    content: '◆';
    font-size: 8px;
    color: #2a1000;
}

/* 历史徽章（已不在榜）— 去掉发光动画，降低饱和度 */
.badge-gold.badge-inactive {
    animation: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    filter: saturate(0.5) brightness(0.75);
}
.badge-silver.badge-inactive {
    animation: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    filter: saturate(0.4) brightness(0.7);
}
.badge-bronze.badge-inactive {
    animation: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    filter: saturate(0.4) brightness(0.7);
}

/* 在榜时显示排名数字（覆盖 ::after 图标） */
.badge-gold.badge-ranked::after,
.badge-silver.badge-ranked::after,
.badge-bronze.badge-ranked::after {
    content: attr(data-rank);
    font-size: 8px;
    font-weight: 900;
    text-shadow: none;
}

/* 动态90徽章 */
.badge-90 {
    background: #0a0a0a;
    border: 1.5px solid transparent;
    background-clip: padding-box;
    overflow: visible;
    animation: badge90-rotate-border 3s linear infinite;
}
.badge-90::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(#ff6b6b, #ffd93d, #6bcb77, #4d96ff, #c77dff, #ff6b6b);
    z-index: -1;
    animation: badge90-rotate-border 2s linear infinite;
}
.badge-90::after {
    content: '';
    position: absolute;
    inset: 1.5px;
    border-radius: 50%;
    background: #0d1117;
    z-index: 0;
}
.badge-90-text {
    position: relative;
    z-index: 1;
    font-size: 7px;
    font-weight: 900;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #c77dff, #ff6b6b);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: badge90-shift 1.5s linear infinite;
}
@keyframes badge90-shift {
    from { background-position: 0% center; }
    to   { background-position: 300% center; }
}
@keyframes badge90-rotate-border {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Developer 徽章 */
.badge-developer {
    background: #060d1a;
    border: 1.5px solid transparent;
    background-clip: padding-box;
    overflow: visible;
}
.badge-developer::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(#00d4ff, #7b2fff, #00d4ff, #0066ff, #00d4ff);
    z-index: -1;
    animation: badge-dev-rotate 2s linear infinite;
}
.badge-developer::after {
    content: '';
    position: absolute;
    inset: 1.5px;
    border-radius: 50%;
    background: #060d1a;
    z-index: 0;
}
.badge-dev-text {
    position: relative;
    z-index: 1;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: #fff;
    text-shadow: 0 0 6px #00d4ff, 0 0 12px #7b2fff;
    font-family: 'Courier New', monospace;
}
@keyframes badge-dev-rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Developer chip（个人主页徽章栏） */
.badge-chip-developer {
    background: rgba(0, 180, 255, 0.08);
    color: #00d4ff;
    border: 1px solid rgba(0, 180, 255, 0.35);
    position: relative;
}
.badge-chip-developer::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(0,212,255,0.06), rgba(123,47,255,0.06));
    pointer-events: none;
}

/* 徽章 tooltip */
.badge-tooltip-wrap {
    position: relative;
    display: inline-block;
}
.badge-tooltip-wrap .badge-tooltip {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a2030;
    color: #c9d1d9;
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #2e3740;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 9999;
}
.badge-tooltip-wrap .badge-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2e3740;
}
.badge-tooltip-wrap:hover .badge-tooltip {
    visibility: visible;
    opacity: 1;
}

/* 佩戴徽章选择器 */
.badge-equip-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6e7681;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
    align-self: center;
}
.badge-equip-btn:hover { color: #c9d1d9; background: rgba(255,255,255,0.07); }

.badge-picker {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 20px;
    background: #1a2030;
    border: 1px solid #2e3740;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
    z-index: 9999;
    min-width: 180px;
    gap: 6px;
    flex-direction: column;
}
.badge-picker.open { display: flex; }
.badge-picker-title {
    font-size: 11px;
    color: #6e7681;
    padding: 2px 4px 6px;
    border-bottom: 1px solid #2e3740;
    margin-bottom: 2px;
}
.badge-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #c9d1d9;
    transition: background 0.12s;
}
.badge-picker-item:hover { background: rgba(255,255,255,0.07); }
.badge-picker-item.selected { background: rgba(0,180,255,0.1); color: #00d4ff; }
.badge-picker-item-none {
    color: #6e7681;
    font-style: italic;
}

/* 排行榜行内的徽章角标（稍小） */
.lb-badge-corner {
    position: absolute;
    top: -4px; right: -4px;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0;   /* 隐藏文字，只显示伪元素图标 */
    font-weight: 900;
    z-index: 2;
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* ==================
   Dev Tools 面板
   ================== */
.nav-devtools {
    color: #3d4a5a !important;
    font-size: 10px !important;
    letter-spacing: 2px;
    border: 1px solid #1e2530;
    border-radius: 2px;
    padding: 2px 6px !important;
}
.nav-devtools:hover { color: #c8a84b !important; border-color: #c8a84b; }

.dev-modal {
    width: 420px;
    background: #0d1117;
    border: 1px solid #2a2f3a;
    border-radius: 4px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

.dev-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: #111620;
    border-bottom: 1px solid #1e2530;
}

.dev-title {
    font-size: 10px;
    letter-spacing: 3px;
    color: #3d4a5a;
    font-weight: 700;
}

.dev-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dev-section-title {
    font-size: 10px;
    letter-spacing: 2px;
    color: #3d4a5a;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.dev-row {
    display: flex;
    gap: 8px;
}

.dev-btn {
    flex: 1;
    padding: 8px 0;
    border: 1px solid;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    background: none;
    transition: opacity 0.15s;
}
.dev-btn:hover { opacity: 0.8; }
.dev-btn:active { opacity: 0.6; }

.dev-btn-win    { color: #4caf50; border-color: #4caf50; }
.dev-btn-draw   { color: #c8a84b; border-color: #c8a84b; }
.dev-btn-lose   { color: #dc3232; border-color: #dc3232; }
.dev-btn-neutral { color: #8a9ab0; border-color: #2a2f3a; }

.dev-result-info {
    font-size: 12px;
    color: #555;
    min-height: 18px;
    letter-spacing: 0.5px;
}

.dev-divider {
    height: 1px;
    background: #1e2530;
    margin: 4px 0;
}

.dev-status {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #3d4a5a;
    letter-spacing: 0.5px;
}

.dev-row-inputs {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.dev-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.dev-input-group label {
    font-size: 10px;
    color: #3d4a5a;
    letter-spacing: 1px;
}

.dev-input-group input {
    background: #0a0e14;
    border: 1px solid #2a2f3a;
    color: #aaa;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 3px;
    width: 100%;
    box-sizing: border-box;
}
.dev-input-group input:focus {
    outline: none;
    border-color: #c8a84b;
}

/* 多人模式导航包装器 */
.nav-item-wrap {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-item-wrap .nav-item {
    height: 100%;
}

/* ==================
   多人模式二级菜单
   ================== */
.nav-multiplayer {
    position: relative;
}

.multiplayer-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #161a1f;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    min-width: 220px;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    overflow: hidden;
}

.submenu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.submenu-item:last-child { border-bottom: none; }
.submenu-item:hover { background: #1e2530; }

.submenu-icon { font-size: 20px; flex-shrink: 0; }

.submenu-title {
    font-size: 13px;
    font-weight: 600;
    color: #d1d9e1;
}
.submenu-desc {
    font-size: 11px;
    color: #5a636c;
    margin-top: 2px;
}

/* ==================
   传统排位模态窗
   ================== */
.ranked-modal {
    width: 720px;
    padding: 0;
    overflow: hidden;
}

.ranked-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #0e1216;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.ranked-mode-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #c8a84b;
    text-transform: uppercase;
}

#ranked-prep-area, #ranked-matching-area, #ranked-game-area, #ranked-result-area {
    padding: 28px 24px;
    text-align: center;
}

.ranked-duel-notice {
    margin: 0 0 16px;
    padding: 8px 14px;
    background: rgba(200,168,75,0.08);
    border: 1px solid rgba(200,168,75,0.4);
    border-radius: 5px;
    font-size: 13px;
    color: #c8a84b;
    text-align: center;
}
.ranked-duel-notice strong { color: #e8c86a; }

.ranked-prep-icon { font-size: 48px; margin-bottom: 12px; }

.ranked-prep-title {
    font-size: 20px;
    font-weight: 700;
    color: #d1d9e1;
    margin-bottom: 8px;
}

.ranked-prep-desc {
    font-size: 13px;
    color: #79838d;
    line-height: 1.6;
    margin-bottom: 20px;
}

.ranked-rules {
    background: #0e1216;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    text-align: left;
}

.ranked-rule-item {
    font-size: 12px;
    color: #79838d;
    padding: 4px 0;
}

.ranked-loading-status {
    margin-bottom: 16px;
}

.ranked-loading-bar-wrap {
    background: #0e1216;
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.ranked-loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #c8a84b, #ffe066);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.ranked-loading-text {
    font-size: 12px;
    color: #79838d;
}

.ranked-prep-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* 游戏中 */
.ranked-game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.ranked-player-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 100px;
}
.ranked-player-right { align-items: flex-end; }

.ranked-player-label {
    font-size: 10px;
    color: #5a636c;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.ranked-player-name {
    font-size: 13px;
    font-weight: 600;
    color: #d1d9e1;
    margin-top: 2px;
}

.ranked-timer-wrap { text-align: center; }

.ranked-timer {
    font-size: 32px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #c8a84b;
    letter-spacing: 2px;
}

.ranked-items-left {
    font-size: 12px;
    color: #79838d;
    margin-top: 4px;
}

.ranked-game-note {
    font-size: 12px;
    color: #5a636c;
    margin-bottom: 20px;
    background: #0e1216;
    padding: 8px 12px;
    border-radius: 4px;
}

/* 结果 */
.ranked-result-badge {
    font-size: 64px;
    margin-bottom: 12px;
}

.ranked-result-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.ranked-result-title.win  { color: #37b26c; }
.ranked-result-title.draw { color: #c8a84b; }
.ranked-result-title.lose { color: #e53935; }

.ranked-result-detail {
    font-size: 13px;
    color: #79838d;
    margin-bottom: 8px;
}

.ranked-result-score {
    font-size: 16px;
    font-weight: 600;
    color: #c8a84b;
    margin-bottom: 20px;
}

/* 毁号实验室占位 */
.lab-modal {
    width: 570px;
    padding: 0;
    overflow: hidden;
}

.lab-coming-soon {
    padding: 40px 24px;
    text-align: center;
}

.lab-title {
    font-size: 18px;
    font-weight: 700;
    color: #d1d9e1;
    margin: 12px 0 8px;
}

.lab-desc {
    font-size: 13px;
    color: #5a636c;
    line-height: 1.6;
}

/* ==================
   排位浮动 HUD
   ================== */
.ranked-hud {
    position: fixed;
    top: 44px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(14, 18, 22, 0.95);
    border: 1px solid rgba(200, 168, 75, 0.4);
    border-radius: 2px;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.ranked-hud-timer {
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #c8a84b;
    letter-spacing: 2px;
    min-width: 90px;
    text-align: center;
}

.ranked-hud-info {
    font-size: 12px;
    color: #79838d;
    white-space: nowrap;
}

.ranked-hud-forfeit {
    background: rgba(229, 57, 53, 0.15);
    border: 1px solid rgba(229, 57, 53, 0.4);
    color: #e53935;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s;
}
.ranked-hud-forfeit:hover { background: rgba(229, 57, 53, 0.3); }

/* ==================
   排位对手左侧面板
   ================== */
.ranked-opponent-panel {
    background: #0e1216;
    border: 1px solid rgba(200, 168, 75, 0.25);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 8px;
}

.rop-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 10px;
}

.rop-label {
    font-size: 10px;
    color: #5a636c;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.rop-name {
    font-size: 13px;
    font-weight: 600;
    color: #d1d9e1;
}

.rop-items-wrap, .rop-timer-wrap {
    margin-bottom: 10px;
}

.rop-items-label, .rop-timer-label {
    font-size: 10px;
    color: #5a636c;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.rop-items-count {
    font-size: 28px;
    font-weight: 700;
    color: #c8a84b;
}

.rop-timer {
    font-size: 14px;
    font-weight: 600;
    color: #79838d;
    font-variant-numeric: tabular-nums;
}

.rop-status {
    font-size: 11px;
    color: #5a636c;
    margin-top: 6px;
}

/* ==================
   排位全屏过渡动画
   ================== */
.ranked-transition {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ranked-transition.hidden { display: none; }

.rt-bg {
    position: absolute;
    inset: 0;
    background: #080b0e;
    opacity: 0.97;
}

.rt-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 700px;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

/* VS 区域 */
.rt-vs-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.rt-vs-wrap.visible {
    opacity: 1;
    transform: scale(1);
}

.rt-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.rt-player-left { animation: slideInLeft 0.5s ease forwards; opacity: 0; }
.rt-player-right { animation: slideInRight 0.5s ease forwards; opacity: 0; }

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-60px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(60px); }
    to   { opacity: 1; transform: translateX(0); }
}

.rt-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #1e2530;
    border: 2px solid #37b26c;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #37b26c;
}
.rt-avatar svg { width: 40px; height: 40px; }

.rt-avatar-enemy {
    border-color: #e53935;
    color: #e53935;
}

.rt-name {
    font-size: 16px;
    font-weight: 700;
    color: #d1d9e1;
    letter-spacing: 1px;
}

.rt-tag {
    font-size: 10px;
    letter-spacing: 2px;
    color: #37b26c;
    font-weight: 700;
}
.rt-tag-enemy { color: #e53935; }

.rt-vs-center {
    flex: 0 0 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rt-vs-text {
    font-size: 48px;
    font-weight: 900;
    color: #c8a84b;
    letter-spacing: 4px;
    text-shadow: 0 0 30px rgba(200,168,75,0.5);
    animation: vsPulse 1s ease infinite alternate;
}

@keyframes vsPulse {
    from { text-shadow: 0 0 20px rgba(200,168,75,0.3); }
    to   { text-shadow: 0 0 40px rgba(200,168,75,0.8); }
}

/* 进度条区域 */
.rt-status-wrap {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.rt-progress-bar-wrap {
    background: #1a1f26;
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}

.rt-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #c8a84b, #ffe066);
    width: 0%;
    transition: width 0.2s ease;
    border-radius: 4px;
}

.rt-status-text {
    font-size: 13px;
    color: #79838d;
    letter-spacing: 1px;
}

/* 倒计时 */
.rt-countdown {
    text-align: center;
    animation: fadeIn 0.3s ease;
}
.rt-countdown.hidden { display: none; }

@keyframes fadeIn {
    from { opacity: 0; transform: scale(1.3); }
    to   { opacity: 1; transform: scale(1); }
}

.rt-countdown-num {
    font-size: 96px;
    font-weight: 900;
    color: #c8a84b;
    line-height: 1;
    text-shadow: 0 0 40px rgba(200,168,75,0.6);
    animation: countPulse 0.8s ease;
}

@keyframes countPulse {
    0%   { transform: scale(1.4); opacity: 0; }
    60%  { transform: scale(0.95); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.rt-countdown-label {
    font-size: 13px;
    color: #79838d;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 8px;
}

/* ── BP 阶段弹窗 ─────────────────────────────────────── */
.bp-modal {
    width: 680px;
    max-width: 96vw;
    background: #1a1f26;
    border: 1px solid #2e3740;
    border-radius: 2px;
    padding: 0;
    overflow: hidden;
}
.bp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #141920;
    border-bottom: 1px solid #2e3740;
}
.bp-tier-label {
    font-size: 15px;
    font-weight: 700;
    color: #c8a84b;
    letter-spacing: 1px;
}
.bp-timer {
    font-size: 22px;
    font-weight: 900;
    color: #e05c5c;
    min-width: 36px;
    text-align: right;
}
.bp-maps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    padding: 16px;
}
.bp-map-card {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, opacity 0.15s;
    aspect-ratio: 16/9;
    background: #0d1117;
}
.bp-map-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.bp-map-card .bp-map-name {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 8px 5px;
    text-align: center;
}
.bp-map-card.selected {
    border-color: #c8a84b;
    box-shadow: 0 0 0 1px #c8a84b;
}
.bp-map-card.selected::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(200,168,75,0.5);
    border-radius: 3px;
    pointer-events: none;
    z-index: 1;
}
.bp-map-card.banned {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}
.bp-map-card.banned::after {
    content: 'BAN';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: 900;
    color: #e05c5c;
    letter-spacing: 2px;
}
.bp-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #2e3740;
    background: #141920;
}
.bp-hint {
    font-size: 13px;
    color: #79838d;
}

/* ── 选定地图全屏揭晓 ────────────────────────────────── */
.map-reveal-frame {
    position: relative;
    padding: 28px 52px;
}
/* 上下横线：完整连接，不留缺口 */
.map-reveal-frame::before,
.map-reveal-frame::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: #fff;
    transform: scaleX(0);
    animation: mapBracketIn 0.45s cubic-bezier(0.22,1,0.36,1) 0.05s forwards;
}
.map-reveal-frame::before {
    top: 0;
    transform-origin: left center;
}
.map-reveal-frame::after {
    bottom: 0;
    transform-origin: right center;
    animation-delay: 0.1s;
}
/* 左右竖线：完整连接 */
.map-reveal-bracket-left,
.map-reveal-bracket-right {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: #fff;
    opacity: 0;
    animation: mapTextIn 0.3s ease 0.4s forwards;
}
.map-reveal-bracket-left {
    left: 0;
}
.map-reveal-bracket-right {
    right: 0;
    animation-delay: 0.45s;
}
.map-reveal-inner {
    text-align: center;
    opacity: 0;
    animation: mapTextIn 0.4s ease 0.5s forwards;
}
.map-reveal-label {
    color: rgba(255,255,255,0.65);
    font-size: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.map-reveal-name {
    color: #fff;
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 3px;
    text-shadow: 0 2px 16px rgba(0,0,0,0.6);
}
@keyframes mapBracketIn {
    0%   { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}
@keyframes mapTextIn {
    0%   { opacity: 0; transform: translateY(6px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ── 导航栏用户按钮 ─────────────────────────────────── */
.nav-user-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.nav-user-btn:hover { background: rgba(255,255,255,0.07); }

.nav-login-hint {
    font-size: 13px;
    font-weight: 700;
    color: #0d1117;
    background: var(--accent-green);
    padding: 4px 12px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.nav-login-hint:hover { filter: brightness(1.1); }

.nav-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: #2a3340;
    border: 2px solid #37b26c;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    overflow: hidden;
}
.nav-username-label {
    font-size: 13px;
    color: #c8d0d8;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 下拉菜单 */
.nav-user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #1a1f26;
    border: 1px solid #2e3740;
    border-radius: 0;
    min-width: 160px;
    z-index: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.nav-user-dropdown.dd-hidden { display: none; }
.nav-dropdown-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px 12px;
    background: #141820;
    gap: 8px;
}
.nav-dropdown-avatar {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #2a3340;
    border: 2px solid #37b26c;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; overflow: hidden;
}
.nav-dropdown-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-dropdown-username {
    font-size: 13px; font-weight: 600; color: #d1d9e1;
    max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-dropdown-item {
    padding: 10px 16px;
    font-size: 13px;
    color: #c8d0d8;
    cursor: pointer;
    transition: background 0.12s;
    white-space: nowrap;
}
.nav-dropdown-item:hover { background: rgba(255,255,255,0.07); }
.nav-dropdown-divider { height: 1px; background: #2e3740; margin: 2px 0; }
.nav-dropdown-danger { color: #e05555; }
.nav-dropdown-danger:hover { background: rgba(224,85,85,0.1); }

/* ── 头像选择器 ─────────────────────────────────────── */
.avatar-picker {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 4px 0;
}
.avatar-option {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #2a3340;
    border: 2px solid transparent;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
.avatar-option:hover { transform: scale(1.1); }
.avatar-option.selected { border-color: #37b26c; }

.auth-avatar-large {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: #2a3340;
    border: 2px solid #37b26c;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
}

/* ── 个人主页弹窗 ────────────────────────────────────── */
#modal-profile { z-index: 1100; }
.profile-modal {
    width: 720px;
    max-width: 96vw;
    background: #1a1f26;
    border: 1px solid #2e3740;
    border-radius: 2px;
    padding: 0;
    overflow: visible;
}
.profile-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 20px 16px;
    background: #141820;
    position: relative;
}
.profile-avatar-wrap { flex-shrink: 0; position: relative; display: inline-block; }
.profile-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: #2a3340;
    border: 2px solid #37b26c;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
}
.profile-info { flex: 1; min-width: 0; }
.profile-username { font-size: 18px; font-weight: 700; color: #d1d9e1; margin-bottom: 4px; }
.profile-bio { font-size: 12px; color: #79838d; margin-bottom: 8px; }
.profile-score-row { display: flex; align-items: center; gap: 12px; }
.profile-score { font-size: 20px; font-weight: 800; color: #c8a84b; }
.profile-wr { font-size: 12px; color: #79838d; }
.modal-close-btn {
    position: absolute; top: 12px; right: 12px;
    background: none; border: none;
    color: #79838d; font-size: 16px; cursor: pointer;
    padding: 4px 6px; border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.modal-close-btn:hover { color: #d1d9e1; background: rgba(255,255,255,0.07); }

.profile-badges {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 12px 20px;
    border-bottom: 1px solid #2e3740;
}
.profile-badge-chip {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.badge-chip-gold   { background: rgba(200,168,75,0.15); color: #c8a84b; border: 1px solid rgba(200,168,75,0.3); }
.badge-chip-silver { background: rgba(180,190,200,0.12); color: #b4bec8; border: 1px solid rgba(180,190,200,0.25); }
.badge-chip-bronze { background: rgba(180,120,60,0.12); color: #b4783c; border: 1px solid rgba(180,120,60,0.25); }
.badge-chip-90     { background: rgba(55,178,108,0.12); color: #37b26c; border: 1px solid rgba(55,178,108,0.25); }

.profile-stats-row {
    display: flex;
    padding: 14px 20px;
    gap: 0;
    border-bottom: 1px solid #2e3740;
}
.profile-stat { flex: 1; text-align: center; }
.profile-stat-val { font-size: 20px; font-weight: 700; color: #d1d9e1; }
.profile-stat-label { font-size: 11px; color: #79838d; margin-top: 2px; }

.profile-history-title {
    padding: 12px 20px 6px;
    font-size: 12px; color: #79838d; letter-spacing: 1px; text-transform: uppercase;
}
.profile-history {
    padding: 0 20px 12px;
    display: flex; flex-direction: column; gap: 4px;
    max-height: 180px; overflow-y: auto;
}
.history-row {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 8px; border-radius: 5px;
    background: #141820; font-size: 12px;
}
.history-result-win   { color: #37b26c; font-weight: 700; width: 24px; }
.history-result-lose  { color: #e05555; font-weight: 700; width: 24px; }
.history-result-draw  { color: #c8a84b; font-weight: 700; width: 24px; }
.history-delta-pos { color: #37b26c; }
.history-delta-neg { color: #e05555; }
.history-score { color: #79838d; margin-left: auto; }

.profile-actions {
    padding: 12px 20px;
    display: flex; gap: 8px;
    border-top: 1px solid #2e3740;
}

/* ── 好友面板 ────────────────────────────────────────── */
.friends-modal {
    width: 870px;
    max-width: 96vw;
    background: #1a1f26;
    border: 1px solid #2e3740;
    border-radius: 2px;
    padding: 0;
    overflow: hidden;
}
.friends-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    background: #141820;
    border-bottom: 1px solid #2e3740;
    position: relative;
}
.friends-title { font-size: 15px; font-weight: 700; color: #d1d9e1; }
.friends-add-row {
    display: flex; gap: 8px;
    padding: 12px 16px 8px;
}
.friends-add-row input {
    flex: 1;
    background: #141820; border: 1px solid #2e3740;
    color: #d1d9e1; border-radius: 6px; padding: 6px 10px; font-size: 13px;
}
.friends-tabs {
    display: flex; border-bottom: 1px solid #2e3740;
    padding: 0 16px;
}
.friends-tab {
    padding: 8px 14px; font-size: 13px; color: #79838d;
    cursor: pointer; border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.friends-tab.active { color: #37b26c; border-bottom-color: #37b26c; }

#friends-list-panel, #friends-requests-panel {
    max-height: 480px; overflow-y: auto;
    padding: 8px 0;
}
.friend-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px;
    transition: background 0.12s;
}
.friend-row:hover { background: rgba(255,255,255,0.04); }
.friend-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: #2a3340; border: 1px solid #37b26c;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}
.friend-name { flex: 1; font-size: 13px; color: #d1d9e1; cursor: pointer; }
.friend-name:hover { color: #37b26c; }
.friend-online-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #37b26c; flex-shrink: 0;
}
.friend-offline-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #3a4250; flex-shrink: 0;
}
.friend-actions { display: flex; gap: 4px; }
.friend-btn {
    padding: 3px 8px; border-radius: 4px; font-size: 11px;
    border: 1px solid #2e3740; background: #141820;
    color: #c8d0d8; cursor: pointer; transition: background 0.12s;
}
.friend-btn:hover { background: #2a3340; }
.friend-btn-danger { border-color: #e05555; color: #e05555; }
.friend-btn-danger:hover { background: rgba(224,85,85,0.1); }
.friend-btn-primary { border-color: #37b26c; color: #37b26c; }
.friend-btn-primary:hover { background: rgba(55,178,108,0.1); }
.friend-btn-duel { border-color: #c8a84b; color: #c8a84b; }
.friend-btn-duel:hover { background: rgba(200,168,75,0.12); }

.friend-avatar-wrap {
    position: relative; width: 32px; height: 32px; flex-shrink: 0;
}
.friend-status-dot {
    position: absolute; bottom: 0; right: 0;
    width: 9px; height: 9px; border-radius: 50%;
    border: 2px solid #0f1318;
}
.friend-online-dot, .friend-status-dot.friend-online-dot { background: #37b26c; }
.friend-offline-dot, .friend-status-dot.friend-offline-dot { background: #3a4250; }
.friend-battle-dot, .friend-status-dot.friend-battle-dot { background: #e07b2a; }
.friend-btn-duel:disabled { opacity: 0.38; cursor: not-allowed; }

/* 决斗邀请弹窗 */
.duel-invite-popup {
    position: fixed; right: 20px; top: 70px; z-index: 9999;
    width: 260px; background: #141820;
    border: 1px solid rgba(200,168,75,0.5);
    border-radius: 10px; padding: 14px 16px 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.6);
    opacity: 0; transform: translateX(20px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}
.duel-invite-popup.visible { opacity: 1; transform: translateX(0); pointer-events: auto; }
.dip-title { font-size: 13px; font-weight: 700; color: #c8a84b; margin-bottom: 6px; }
.dip-msg { font-size: 13px; color: #d1d9e1; margin-bottom: 3px; }
.dip-note { font-size: 11px; color: #79838d; margin-bottom: 10px; }
.dip-timer-bar { height: 3px; background: #2a3340; border-radius: 2px; margin-bottom: 10px; overflow: hidden; }
.dip-timer-fill { height: 100%; width: 100%; background: #c8a84b; border-radius: 2px; }
.dip-actions { display: flex; gap: 8px; }
.dip-btn { flex: 1; padding: 5px 0; border-radius: 5px; font-size: 12px; cursor: pointer; border: 1px solid; }
.dip-accept { background: rgba(55,178,108,0.12); border-color: #37b26c; color: #37b26c; }
.dip-accept:hover { background: rgba(55,178,108,0.22); }
.dip-reject { background: rgba(224,85,85,0.08); border-color: #e05555; color: #e05555; }
.dip-reject:hover { background: rgba(224,85,85,0.18); }

.friends-duel-notice {
    margin: 0 16px 10px;
    padding: 7px 12px;
    background: rgba(200,168,75,0.08);
    border: 1px solid rgba(200,168,75,0.35);
    border-radius: 5px;
    font-size: 12px;
    color: #c8a84b;
    text-align: center;
    letter-spacing: 0.3px;
}
.friends-duel-notice strong { color: #e8c86a; }

.friends-req-section { padding: 8px 16px 4px; }
.friends-req-label { font-size: 11px; color: #79838d; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
.friends-empty { padding: 16px; text-align: center; color: #3a4250; font-size: 13px; }

/* ── 账号设置弹窗 ────────────────────────────────────── */
.settings-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px 10px;
    border-bottom: 1px solid #2e3740;
    position: relative;
}
.settings-title { font-size: 15px; font-weight: 700; color: #d1d9e1; }
.settings-section { padding: 14px 20px 0; }
.settings-section-title { font-size: 11px; color: #79838d; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.settings-section textarea {
    width: 100%; background: #141820; border: 1px solid #2e3740;
    color: #d1d9e1; border-radius: 6px; padding: 8px 10px;
    font-size: 13px; resize: none; box-sizing: border-box;
}
.settings-section input[type="email"] {
    width: 100%; background: #141820; border: 1px solid #2e3740;
    color: #d1d9e1; border-radius: 6px; padding: 8px 10px;
    font-size: 13px; box-sizing: border-box;
}

.session-row {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0; border-bottom: 1px solid #1e2530;
    font-size: 12px;
}
.session-row:last-child { border-bottom: none; }
.session-ua { flex: 1; color: #79838d; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-time { color: #3a4250; flex-shrink: 0; }
.session-current { color: #37b26c; font-size: 11px; flex-shrink: 0; }

/* auth hint */
.auth-hint { font-size: 12px; color: #79838d; padding: 4px 0; }

/* ── 头像上传 ────────────────────────────────────────── */
.avatar-upload-row {
    display: flex; align-items: center; gap: 14px; margin-bottom: 10px;
}
.avatar-preview-large {
    width: 52px; height: 52px; border-radius: 50%;
    background: #2a3340; border: 2px solid #37b26c;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; overflow: hidden; flex-shrink: 0;
}
.avatar-preview-large img { width: 100%; height: 100%; object-fit: cover; }
.avatar-upload-btns { display: flex; flex-direction: column; gap: 6px; }
.avatar-upload-label {
    display: inline-block; padding: 5px 12px;
    border: 1px solid #2e3740; background: #141820;
    color: #c8d0d8; font-size: 12px; cursor: pointer;
    transition: background 0.12s;
}
.avatar-upload-label:hover { background: #2a3340; }
.avatar-upload-hint { font-size: 11px; color: #79838d; }

/* ── 聊天弹窗 ────────────────────────────────────────── */
.chat-modal {
    width: 840px; max-width: 96vw;
    height: 720px; max-height: 90vh;
    background: #1a1f26; border: 1px solid #2e3740;
    border-radius: 2px; padding: 0; overflow: hidden;
    display: flex; flex-direction: column;
}
.chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: #141820;
    border-bottom: 1px solid #2e3740; position: relative; flex-shrink: 0;
}
.chat-title { font-size: 14px; font-weight: 700; color: #d1d9e1; }
.chat-layout {
    display: flex; flex: 1; overflow: hidden;
}
.chat-sidebar {
    width: 100px; flex-shrink: 0;
    background: #141820; border-right: 1px solid #2e3740;
    overflow-y: auto; display: flex; flex-direction: column;
}
.chat-tab {
    padding: 10px 12px; font-size: 12px; color: #79838d;
    cursor: pointer; transition: background 0.12s, color 0.12s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-tab:hover { background: rgba(255,255,255,0.05); color: #c8d0d8; }
.chat-tab.active { background: rgba(55,178,108,0.1); color: #37b26c; border-left: 2px solid #37b26c; }
.chat-tab-unread-dot {
    position: absolute; top: 6px; right: 6px;
    width: 7px; height: 7px; border-radius: 50%;
    background: #e05555; pointer-events: none;
}
.chat-sidebar-divider { height: 1px; background: #2e3740; margin: 4px 0; }
.chat-main {
    flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.chat-messages {
    flex: 1; overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
}
.chat-bubble-wrap {
    display: flex; align-items: flex-start; gap: 6px;
}
.chat-bubble-wrap.self { flex-direction: row-reverse; }
.chat-bubble-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: #2a3340; border: 1px solid #2e3740;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0; overflow: hidden;
}
.chat-bubble-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-bubble-body { max-width: 70%; }
.chat-bubble-name { font-size: 10px; color: #79838d; margin-bottom: 2px; }
.chat-bubble-wrap.self .chat-bubble-name { text-align: right; }
.chat-bubble {
    padding: 7px 11px; font-size: 13px; color: #d1d9e1;
    background: #1e2530; border: 1px solid #2e3740;
    border-radius: 2px; word-break: break-word; line-height: 1.5;
}
.chat-bubble-wrap.self .chat-bubble {
    background: #1a3a28; border-color: #2a5a3a; color: #c8e8d0;
}
.chat-bubble-time {
    font-size: 10px;
    color: #4a5560;
    margin-top: 3px;
}
.chat-bubble-wrap.self .chat-bubble-time {
    text-align: right;
}
.chat-input-row {
    display: flex; gap: 8px; padding: 10px 12px;
    border-top: 1px solid #2e3740; flex-shrink: 0;
}
.chat-input-row input {
    flex: 1; background: #141820; border: 1px solid #2e3740;
    color: #d1d9e1; padding: 7px 10px; font-size: 13px; border-radius: 2px;
}
.chat-send-btn { padding: 7px 16px; font-size: 13px; }
.nav-msg-badge {
    position: absolute; top: 2px; right: 2px;
    width: 8px; height: 8px; border-radius: 50%;
    background: #e05555;
}
.nav-msg-badge.hidden { display: none; }

/* ========== 移动端/平板响应式适配 ========== */

.nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 12px;
    height: 100%;
    align-items: center;
    flex-shrink: 0;
}

.mobile-tab-bar {
    display: none;
}

/* ===== 平板端 768px ~ 1024px ===== */
@media (max-width: 1024px) {
    :root {
        --grid-size: 52px;
        --grid-gap: 2px;
    }

    .equip-section {
        width: 260px;
    }

    .right-warehouse-panel {
        max-width: 540px;
    }

    .nav-item:not(.start-game):not(#nav-online):not(#nav-leaderboard):not(.active) {
        display: none;
    }

    .nav-brand-right {
        display: none;
    }
}

/* ===== 手机端 ≤767px ===== */
@media (max-width: 767px) {
    :root {
        --grid-size: 44px;
        --grid-gap: 1px;
    }

    body {
        overflow: auto;
        height: auto;
        min-height: 100dvh;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .global-navbar {
        height: 48px;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .nav-hamburger {
        display: flex;
    }

    .nav-left .nav-item,
    .nav-left .nav-item-wrap,
    .nav-brand-right {
        display: none;
    }

    /* 汉堡展开后的下拉导航 */
    .nav-left.mobile-open {
        position: static;
    }

    .nav-left.mobile-open .nav-item,
    .nav-left.mobile-open .nav-item-wrap {
        display: flex;
        position: fixed;
        left: 0;
        top: 48px;
        width: 180px;
        height: 44px;
        background: var(--bg-nav);
        border-right: 1px solid var(--border-dim);
        border-bottom: 1px solid rgba(255,255,255,0.04);
        z-index: 999;
        padding: 0 16px;
        font-size: 14px;
    }

    .nav-left.mobile-open .nav-item:nth-child(2)  { top: 48px; }
    .nav-left.mobile-open .nav-item-wrap:nth-child(3) { top: 92px; }
    .nav-left.mobile-open .nav-item:nth-child(4)  { top: 136px; }
    .nav-left.mobile-open .nav-item:nth-child(5)  { top: 180px; }
    .nav-left.mobile-open .nav-item:nth-child(6)  { top: 224px; }
    .nav-left.mobile-open .nav-item:nth-child(7)  { top: 268px; }
    .nav-left.mobile-open .nav-item:nth-child(8)  { top: 312px; }
    .nav-left.mobile-open .nav-item:nth-child(9)  { top: 356px; }

    /* 主布局单栏 */
    .app-layout {
        flex-direction: column;
        overflow: visible;
        height: auto;
    }

    /* 三个面板默认隐藏，通过 Tab 切换 */
    .left-character-panel,
    .right-warehouse-panel {
        display: none;
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        min-height: 50vh;
    }

    .left-character-panel.mobile-active,
    .right-warehouse-panel.mobile-active {
        display: flex;
    }

    /* 仓库面板默认显示 */
    .right-warehouse-panel {
        display: flex;
    }

    /* 底部 Tab 栏 */
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 48px;
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--bg-nav);
        border-top: 1px solid var(--border-dim);
        z-index: 1000;
    }

    .mobile-tab {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
        color: var(--text-muted);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.15s;
    }

    .mobile-tab.active {
        color: var(--accent-green);
        border-top: 2px solid var(--accent-green);
    }

    /* 底部 Tab 占位，防止内容被遮挡 */
    body::after {
        content: '';
        display: block;
        height: calc(48px + env(safe-area-inset-bottom));
    }

    /* 网格区横向可滚动 */
    .inventory-scroll-area {
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 模态框全屏 */
    .modal {
        align-items: flex-end !important;
    }

    .modal-content,
    .config-modal,
    .sell-confirm-box,
    .ranked-modal-content {
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 90vh !important;
        border-radius: 8px 8px 0 0 !important;
        overflow-y: auto;
    }

    /* 聊天框 */
    .chat-modal {
        width: 100vw !important;
        height: 65vh !important;
        bottom: calc(48px + env(safe-area-inset-bottom)) !important;
        right: 0 !important;
        left: 0 !important;
        border-radius: 8px 8px 0 0 !important;
    }

    /* 触控区域最小 44px */
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .nav-icon-btn,
    .sidebar-icon {
        min-height: 44px;
    }

    /* 装备区域 */
    .equip-section {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-dim);
    }

    .left-character-panel {
        flex-direction: column;
    }

    .character-bottom-info {
        position: static;
        padding: 12px 16px;
    }

    .character-preview-area {
        display: none;
    }

    /* 交易行 */
    .trading-post-panel {
        width: 100%;
    }

    /* 货币文字在小屏缩短 */
    .currency {
        font-size: 12px;
        padding: 0 8px !important;
    }
}

/* 主题选择器 */
.theme-picker {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.theme-option:hover {
    background: rgba(255,255,255,0.05);
}

.theme-option.selected {
    border-color: var(--primary);
}

.theme-preview {
    width: 80px;
    height: 50px;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.theme-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.15;
}

.theme-preview.theme-gold {
    background: linear-gradient(135deg, #1a1510 0%, #2a2010 100%);
    border: 2px solid rgba(200,168,75,0.6);
}

.theme-preview.theme-gold::before {
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(200,168,75,0.5) 10px, rgba(200,168,75,0.5) 11px);
}

.theme-preview.theme-blue {
    background: linear-gradient(135deg, #0a1520 0%, #0f1f35 100%);
    border: 2px solid rgba(100,150,255,0.6);
}

.theme-preview.theme-blue::before {
    background-image: radial-gradient(circle at 10px 10px, rgba(100,150,255,0.5) 2px, transparent 2px);
    background-size: 20px 20px;
}

.theme-preview.theme-purple {
    background: linear-gradient(135deg, #1a0a20 0%, #2a1535 100%);
    border: 2px solid rgba(180,100,255,0.6);
}

.theme-preview.theme-purple::before {
    background-image: repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(180,100,255,0.5) 15px, rgba(180,100,255,0.5) 16px);
}

.theme-preview.theme-red {
    background: linear-gradient(135deg, #200a0a 0%, #351515 100%);
    border: 2px solid rgba(255,100,100,0.6);
}

.theme-preview.theme-red::before {
    background-image: repeating-linear-gradient(135deg, transparent, transparent 12px, rgba(255,100,100,0.5) 12px, rgba(255,100,100,0.5) 14px);
}

/* 徽章装备区域 */
.badge-equip-section {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.badge-slot-group {
    flex: 1;
    min-width: 200px;
}

.badge-slot-group label {
    display: block;
    margin-bottom: 8px;
    color: #c8a84b;
    font-size: 14px;
}

.badge-slot-group select {
    width: 100%;
    padding: 8px 12px;
    background: #20242a;
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.badge-slot-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ==================
   单人游戏结算
   ================== */
.solo-result-area {
    padding: 40px 30px;
    text-align: center;
}

.solo-result-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.solo-result-map {
    font-size: 18px;
    color: #c8a84b;
    margin-bottom: 30px;
    font-weight: 600;
}

.solo-result-time-wrap,
.solo-result-best-wrap {
    margin-bottom: 20px;
}

.solo-result-label {
    font-size: 12px;
    color: #79838d;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.solo-result-time {
    font-size: 32px;
    color: #fff;
    font-weight: 600;
}

.solo-result-best {
    font-size: 28px;
    color: #c8a84b;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.solo-result-new-badge {
    display: inline-block;
    background: linear-gradient(135deg, #c8a84b 0%, #f4d03f 100%);
    color: #000;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 0 0 10px rgba(200,168,75,0.5);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 20px rgba(200,168,75,0.8);
        transform: scale(1.05);
    }
}

#solo-result-close-btn {
    margin-top: 20px;
}

