/* ============================================================
   统一顶部栏样式（参考 pinyin.html 柔感语言）
   —— 纯白实底胶囊 + 暖棕柔和阴影 + 去除毛玻璃
   所有页面通过 <link rel="stylesheet" href="/topbar.css"> 引用
   覆盖 .topbar / .back-link / .user-pill / .login-btn-top / .topbar-left
   ============================================================ */
:root {
    --tb-soft-shadow: 0 14px 30px rgba(186, 148, 104, 0.18);
    --tb-soft-shadow-hover: 0 20px 40px rgba(186, 148, 104, 0.26);
    --tb-ink: #6a5f8a;
    --tb-accent: #7C6BE0;
}

.topbar {
    position: relative;
    z-index: 2;
    width: 100%;
    margin: 0 auto;
    padding: 14px 20px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* 左侧：返回首页 / 站点标识 */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;                 /* 触摸目标 ≥44px */
    padding: 0 16px 0 12px;
    border-radius: 19px;
    background: #FFFFFF;
    border: none;
    box-shadow: var(--tb-soft-shadow);
    color: #FF7AA8;
    font-size: 14.5px;
    font-weight: 800;
    text-decoration: none;
    transition: transform 0.18s, box-shadow 0.18s;
}
.back-link:hover { transform: translateY(-2px); box-shadow: var(--tb-soft-shadow-hover); }
.back-link:active { transform: translateY(0); box-shadow: var(--tb-soft-shadow); }
.back-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 122, 168, 0.35), var(--tb-soft-shadow);
}
.back-link svg { width: 18px; height: 18px; }

/* 站点标识（首页等无返回链接时） */
.topbar-left {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: 'HarmonyOS Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #4a4160;
}
.topbar-left .brand-logo {
    width: 30px; height: 30px;
    border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #9C84F4;
    box-shadow: 0 6px 14px rgba(156, 132, 244, 0.34);
}

/* 右侧：登录信息胶囊（游客 / 已登录共用） */
.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 15px;
    border-radius: 19px;
    background: #FFFFFF;
    border: none;
    font-size: 13px;
    font-weight: 700;
    color: #7C6BE0;
    box-shadow: var(--tb-soft-shadow);
    cursor: default;
}
.user-pill .avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    background: #B7A8F2;
    flex: 0 0 24px;
}

/* 未登录时的登录按钮（与柔感胶囊同语言） */
.login-btn-top {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 19px;
    background: #FFFFFF;
    border: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: #7C6BE0;
    cursor: pointer;
    box-shadow: var(--tb-soft-shadow);
    transition: transform 0.18s, box-shadow 0.18s;
}
.login-btn-top:hover { transform: translateY(-2px); box-shadow: var(--tb-soft-shadow-hover); }
.login-btn-top:active { transform: translateY(0); box-shadow: var(--tb-soft-shadow); }
.login-btn-top:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 107, 224, 0.35), var(--tb-soft-shadow);
}

/* 用户区域：允许收缩，防止移动端溢出 */
#userArea {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
    gap: 8px;
}
#userArea .member-badge { flex-shrink: 0; }
#userArea .user-pill,
#userArea .login-btn-top { flex-shrink: 1; min-width: 0; }

/* 移动端：顶部栏收一点，避免与内容太挤 */
@media (max-width: 640px) {
    .topbar { padding: 10px 10px 4px; gap: 8px; }
    .back-link { padding: 0 12px 0 9px; font-size: 13.5px; }
    .user-pill, .login-btn-top { padding: 0 12px; font-size: 12.5px; min-height: 38px; }
    .member-badge { padding: 4px 10px; font-size: 11.5px; margin-right: 6px; }
    .member-badge .dot { width: 7px; height: 7px; }
    .topbar-left { font-size: 14.5px; }
    .topbar-left .brand-logo { width: 26px; height: 26px; }
}
@media (max-width: 480px) {
    .member-badge .badge-text { display: none; }
    .member-badge { padding: 6px; margin-right: 4px; }
}

/* 触摸 / 窄屏：取消顶栏 hover 上浮，改中心按压（避免错位，与卡片一致） */
@media (hover: none), (max-width: 560px) {
    .back-link:hover, .login-btn-top:hover {
        transform: none;
        box-shadow: var(--tb-soft-shadow);
    }
    .back-link:active, .login-btn-top:active { transform: scale(0.97); }
}
