/* =============================================================
   联机大厅 - 基础布局与左侧用户信息栏
   配色：红警2 深蓝灰科技风
   ============================================================= */

:root {
    --ra-bg-0: #05090d;
    --ra-bg-1: #081018;
    --ra-panel: #0f1a24;
    --ra-panel-2: #132231;
    --ra-line: #1f3345;
    --ra-accent: #3fa9f5;
    --ra-accent-strong: #7fd1ff;
    --ra-accent-soft: rgba(63, 169, 245, 0.12);
    --ra-text: #c9d9e8;
    --ra-text-dim: #7d93a6;
    --ra-text-bright: #eaf6ff;
    --ra-amber: #e7b45b;
    --sidebar-width: 280px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(1000px 520px at 80% 0%, rgba(63, 169, 245, 0.07), transparent 65%),
        radial-gradient(800px 420px at 0% 100%, rgba(30, 90, 140, 0.08), transparent 60%),
        linear-gradient(180deg, var(--ra-bg-0) 0%, var(--ra-bg-1) 100%);
    color: var(--ra-text);
    font-family: "Microsoft YaHei", "Microsoft JhengHei", "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

.lobby-layout {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

/* -------------------------------------------------------------
   左侧第一栏：固定 280px
   ------------------------------------------------------------- */
.lobby-sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    padding: 18px 14px;
    overflow: hidden;
    background: linear-gradient(180deg, #0b141d 0%, #070d13 100%);
    border-right: 1px solid var(--ra-line);
    box-shadow: inset -1px 0 0 rgba(63, 169, 245, 0.06), 12px 0 30px rgba(0, 0, 0, 0.35);
}

.lobby-sidebar::-webkit-scrollbar,
.sidebar-panel-body::-webkit-scrollbar {
    width: 6px;
}

.lobby-sidebar::-webkit-scrollbar-track,
.sidebar-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.lobby-sidebar::-webkit-scrollbar-thumb,
.sidebar-panel-body::-webkit-scrollbar-thumb {
    background: rgba(63, 169, 245, 0.22);
    border-radius: 3px;
}

/* -------------------------------------------------------------
   用户信息卡片
   ------------------------------------------------------------- */
.user-card {
    position: relative;
    flex: 0 0 auto;
    padding: 22px 16px 16px;
    background: linear-gradient(180deg, rgba(19, 34, 49, 0.96) 0%, rgba(10, 18, 26, 0.96) 100%);
    border: 1px solid var(--ra-line);
    border-radius: 2px;
    box-shadow:
        inset 0 0 0 1px rgba(63, 169, 245, 0.04),
        0 12px 28px rgba(0, 0, 0, 0.35);
    clip-path: polygon(
        0 0,
        calc(100% - 14px) 0,
        100% 14px,
        100% 100%,
        14px 100%,
        0 calc(100% - 14px)
    );
}

.user-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 72px;
    height: 2px;
    background: linear-gradient(90deg, var(--ra-accent), transparent);
}

.user-card::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 48px;
    height: 2px;
    background: linear-gradient(270deg, rgba(63, 169, 245, 0.55), transparent);
}

/* -------------------------------------------------------------
   头像：圆形 80x80
   ------------------------------------------------------------- */
.user-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    overflow: hidden;
    border: 2px solid rgba(63, 169, 245, 0.65);
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, #1b3042 0%, #0a131c 75%);
    box-shadow:
        0 0 0 4px rgba(63, 169, 245, 0.08),
        0 0 22px rgba(63, 169, 245, 0.22);
}

.user-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #78cfff;
}

.avatar-fallback svg {
    width: 42px;
    height: 42px;
    opacity: 0.9;
}

/* -------------------------------------------------------------
   昵称：16px 加粗
   ------------------------------------------------------------- */
.user-name {
    margin: 16px 0 0;
    color: var(--ra-text-bright);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.5px;
    text-align: center;
    text-shadow: 0 0 12px rgba(63, 169, 245, 0.25);
    word-break: break-all;
}

/* -------------------------------------------------------------
   统计信息
   ------------------------------------------------------------- */
.user-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 18px 0 0;
    padding: 14px 0 0;
    border-top: 1px solid rgba(63, 169, 245, 0.16);
}

.stat-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.stat-row dt {
    flex: 0 0 auto;
    color: var(--ra-text-dim);
    font-size: 12px;
    line-height: 1.6;
    white-space: nowrap;
}

.stat-row dd {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    color: var(--ra-text);
    font-size: 13px;
    line-height: 1.6;
    text-align: right;
}

.stat-value {
    color: #d8ecff;
    font-variant-numeric: tabular-nums;
}

.stat-empty {
    color: var(--ra-text-dim);
    font-size: 12px;
}

/* 常玩地图标签 */
.map-list {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.map-tag {
    max-width: 100%;
    padding: 3px 8px;
    overflow: hidden;
    color: #bfe6ff;
    font-size: 12px;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: linear-gradient(180deg, rgba(63, 169, 245, 0.12), rgba(63, 169, 245, 0.04));
    border: 1px solid rgba(63, 169, 245, 0.35);
    clip-path: polygon(
        6px 0,
        100% 0,
        100% calc(100% - 6px),
        calc(100% - 6px) 100%,
        0 100%,
        0 6px
    );
}

/* -------------------------------------------------------------
   进入用户中心按钮
   ------------------------------------------------------------- */
.btn-user-center {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    margin-top: 20px;
    color: #e1f4ff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-decoration: none;
    background: linear-gradient(180deg, rgba(63, 169, 245, 0.22), rgba(63, 169, 245, 0.07));
    border: 1px solid rgba(63, 169, 245, 0.5);
    clip-path: polygon(
        10px 0,
        100% 0,
        100% calc(100% - 10px),
        calc(100% - 10px) 100%,
        0 100%,
        0 10px
    );
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-user-center:hover {
    background: linear-gradient(180deg, rgba(63, 169, 245, 0.32), rgba(63, 169, 245, 0.12));
    border-color: rgba(127, 209, 255, 0.9);
    box-shadow:
        0 0 18px rgba(63, 169, 245, 0.28),
        inset 0 0 12px rgba(127, 209, 255, 0.12);
}

.btn-user-center:active {
    transform: translateY(1px);
}

.btn-user-center:focus-visible {
    outline: 2px solid var(--ra-accent-strong);
    outline-offset: 2px;
}

/* -------------------------------------------------------------
   大厅主区域（本阶段仅保留布局占位）
   ------------------------------------------------------------- */
.lobby-main {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 100vh;
    background-image:
        linear-gradient(rgba(63, 169, 245, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(63, 169, 245, 0.035) 1px, transparent 1px);
    background-size: 36px 36px;
}

.lobby-main::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(70% 60% at 50% 45%, transparent 0%, rgba(5, 9, 13, 0.55) 100%);
    pointer-events: none;
}

/* -------------------------------------------------------------
   左侧第二、三栏：游戏统计 / 好友列表
   与第一栏同处 280px 区域，上下各占剩余高度约 50%，独立滚动
   ------------------------------------------------------------- */
.sidebar-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    background: linear-gradient(180deg, rgba(15, 26, 36, 0.96) 0%, rgba(8, 16, 24, 0.96) 100%);
    border: 1px solid var(--ra-line);
    border-radius: 2px;
    box-shadow: inset 0 0 0 1px rgba(63, 169, 245, 0.03);
    clip-path: polygon(
        0 0,
        calc(100% - 10px) 0,
        100% 10px,
        100% 100%,
        10px 100%,
        0 calc(100% - 10px)
    );
}

.sidebar-panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 44px;
    height: 2px;
    background: linear-gradient(90deg, var(--ra-accent), transparent);
}

.sidebar-panel-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(63, 169, 245, 0.18);
}

.sidebar-panel-title {
    margin: 0;
    color: var(--ra-text-bright);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
}

.sidebar-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 8px 10px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-color: rgba(63, 169, 245, 0.28) transparent;
    scrollbar-width: thin;
}

.panel-empty {
    margin: 18px 0 0;
    color: var(--ra-text-dim);
    font-size: 12px;
    text-align: center;
}

/* -------------------------------------------------------------
   游戏统计
   ------------------------------------------------------------- */
.stats-group + .stats-group {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(63, 169, 245, 0.14);
}

.stats-mode {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 6px;
    background: linear-gradient(90deg, rgba(63, 169, 245, 0.14), rgba(63, 169, 245, 0.02));
    border-left: 2px solid rgba(63, 169, 245, 0.6);
}

.stats-mode-name {
    min-width: 0;
    overflow: hidden;
    color: #bfe6ff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-mode-total {
    flex: 0 0 auto;
    color: var(--ra-text-dim);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.stats-map-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
}

.stats-map {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 6px 5px 10px;
    border-bottom: 1px solid rgba(63, 169, 245, 0.07);
}

.stats-map:last-child {
    border-bottom: 0;
}

.stats-map-name {
    min-width: 0;
    overflow: hidden;
    color: var(--ra-text);
    font-size: 12px;
    line-height: 1.6;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-map-meta {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.45;
}

.stats-map-time {
    color: #9fd8ff;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.stats-map-count {
    color: var(--ra-text-dim);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* -------------------------------------------------------------
   好友列表
   ------------------------------------------------------------- */
.friend-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.friend-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 6px;
    border: 1px solid transparent;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.friend-item:hover,
.friend-item:focus-within {
    background: rgba(63, 169, 245, 0.08);
    border-color: rgba(63, 169, 245, 0.24);
}

/* 头像 32x32，同时作为私聊入口 */
.friend-avatar {
    display: flex;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    overflow: hidden;
    color: #78cfff;
    background: radial-gradient(circle at 50% 35%, #1b3042 0%, #0a131c 75%);
    border: 1px solid rgba(63, 169, 245, 0.45);
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.friend-avatar:hover,
.friend-avatar:focus-visible {
    border-color: rgba(127, 209, 255, 0.9);
    box-shadow: 0 0 10px rgba(63, 169, 245, 0.4);
    outline: none;
}

.friend-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-avatar svg {
    width: 20px;
    height: 20px;
}

.friend-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--ra-text);
    font-size: 13px;
    line-height: 1.6;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 在线状态圆点：默认灰色（未知/离线），在线时绿色 */
.friend-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    background: #5a6b79;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.friend-item.is-online .friend-dot {
    background: #37d67a;
    box-shadow: 0 0 8px rgba(55, 214, 122, 0.75);
}

/* 悬浮详情 */
.friend-popover {
    position: absolute;
    top: calc(100% - 2px);
    left: 44px;
    z-index: 5;
    width: 180px;
    padding: 8px 10px;
    background: #0a141d;
    border: 1px solid rgba(63, 169, 245, 0.34);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    pointer-events: none;
}

.friend-item:hover .friend-popover,
.friend-item:focus-within .friend-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 靠近列表底部时向上展开，避免被滚动区域裁切 */
.friend-item.is-popover-up .friend-popover {
    top: auto;
    bottom: calc(100% - 2px);
    transform: translateY(4px);
}

.friend-item.is-popover-up:hover .friend-popover,
.friend-item.is-popover-up:focus-within .friend-popover {
    transform: translateY(0);
}

.friend-detail-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 0;
    font-size: 12px;
    line-height: 1.6;
}

.friend-detail-label {
    flex: 0 0 auto;
    color: var(--ra-text-dim);
}

.friend-detail-value {
    min-width: 0;
    overflow: hidden;
    color: #cfe9ff;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}
